Code example/article/tutorial about async development on NEAR. There is an opinion: NEAR is async blockchain and there is no way to "roll back" transactions if any fail occurs BUT other "synchronised" blockchains with "Atomic Cross Contract Calls" are more convenient specially for DeFi apps.
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)
[ ] make an example
[ ] write a content / doc
What is the t-shirt size of this? (range: x-small is 1 hour, x-large is over a month of work)
[ ] medium
What priority is this? (remove what doesn't apply)
[ ] P3 (Nice-to-have: docs or features that improve a flow)
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)