Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ppedziwiatr opened this issue Jun 22, 2021 · 1 comment
Open

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

ppedziwiatr opened this issue Jun 22, 2021 · 1 comment

Comments

@ppedziwiatr
Copy link
Contributor

ppedziwiatr commented 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 the caller contract can read updated state from callee contract and perform its logic - that's really inconvenient.

@jakub-wojciechowski
Copy link

As, the SmartWeave.contracts.readContractState method needs to load and replay all the transactions, allowing interactRead should not affect the performance.

@ppedziwiatr ppedziwiatr changed the title Add feature to call "interactRead" from other contract Add a feature to call "interactRead" from other contract Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants