ref-finance / ref-contracts

Smart contracts for Ref Finance
MIT License
96 stars 55 forks source link

Feature instant swap #44

Closed marco-sundsk closed 2 years ago

marco-sundsk commented 2 years ago
marco-sundsk commented 2 years ago

Considering internal_send_tokens takes around 50Tgas, we can only do around 5 token transfers, but that's probably fine, since instant swap right now should lead to sending only one token.

Failure is permitted, but token loss isn't. So I think we need ensure even in that situation (gas insurfficent to send all tokens), the whole instant-swap would fail before cross-contract calls, to make the ft_transfer_call failure without any token transferred to ref.