near / devrel

The space for DevRel
MIT License
9 stars 0 forks source link

[TASK] Best Practices: How to "revert" smart contract action in async environment #422

Open zavodil opened 2 years ago

zavodil commented 2 years ago

What is this for?

We can create an example app with some internal balances in FT and create: 1) ft_transfer method to withdraw user funds and update balance 2) check a callback, verify it signer 3) revert user balance if withdraw method failed

or even something more complex: 1) update internal balance and make a swap on ref finance (asset1 -> asset2) 2) if swap succeeded: update internal balances (asset is still 0, asset2 is N) 3) make storage_deposit for asset2 for current user 4) withdraw asset2 and revert balance if failed (as in example above)

Who needs to be involved?

Tasks to complete (can return to [x] these)

What is the t-shirt size of this? (range: x-small is 1 hour, x-large is over a month of work)

What priority is this? (remove what doesn't apply)