Skip to content

NearPromise and transaction atomicity #316

Answered by evgenykuzyakov
sgraphics asked this question in Q&A
Discussion options

You must be logged in to vote

If transfer promise is scheduled, then it subtracts the balance immediately. But the remote execution (deposit) can happen later.

Similar to the function calls with attached deposits. If you schedule it successfully during the current receipt execution, then it will be executed at some point in the future. So if you do assert and then transfer, you should be fine.

As for reverts, the way it's usually done on NEAR is to track required information locally if you can (e.g. current token balances for your contract/users). If you can't track it locally, then you need to try to accumulate required resources first before doing transfers, e.g. pull all the resources into this contract, then make …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gagdiez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants