Let's say:
- I have two smart contracts X and Y. The cross-contract (XSS) flow is Alice -> X -> Y.
- Y transfers some tokens to X. The XSS to Y does not return how many tokens were transferred, so X needs to check its balance using
ft_balance_of()
. - The tokens have to be transferred back to Alice.
Is it safe to transfer the entire token balance of X, as returned by ft_balance_of()
? Say that Bob calls X around the same time as Alice. Since XSS on NEAR is async,can Alice get credited with Bob's funds?
Additional context
My contract X is calling ft_transfer_call()
on Ref exchange (instant swap). Apparently the promise returns how many tokens were consumed, not how many returned.