You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
As, the SmartWeave.contracts.readContractState method needs to load and replay all the transactions, allowing interactRead should not affect the performance.
ppedziwiatr
changed the title
Add feature to call "interactRead" from other contract
Add a feature to call "interactRead" from other contract
Jun 22, 2021
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 thecaller
contract can read updated state fromcallee
contract and perform its logic - that's really inconvenient.The text was updated successfully, but these errors were encountered: