Skip to content

Add a feature to call "interactRead" from other contract #78

@ppedziwiatr

Description

@ppedziwiatr

Currently SWC offers only one way of calling other contract - ie. reading its current state:
SmartWeave.contracts.readContractState(contractId: string): Promise<any>

This is somewhat limiting, as it prevents from calling any logic from external contract.

As "interactRead" does not change state (ie. it only returns "result", not new "state"), adding a feature to call it from another contract doesn't seem to introduce any security risks.

Having such feature would allow to split business logic between different contracts (eg. vesting or staking contract and PST contract).

Current workaround forces to firstly call state update on the callee contract (and wait for a transaction to be mined) - only then the caller contract can read updated state from callee contract and perform its logic - that's really inconvenient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions