ref-finance / ref-contracts

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

Direct swap approach #24

Closed referencedev closed 3 years ago

referencedev commented 3 years ago

The idea is to add "direct swap" approach that doesn't require deposit/withdraw in most cases. The way it will work:

Note that user still MUST be register for outgoing token ahead of time to prevent loss of funds in case they are not registered on the receiving end.

This requirement can be lifted by the caller by passing force=1, if they guarantee that user's account is registered. In case the user is not registered at the end - the funds will be returned to the exchange owner.

robert-zaremba commented 3 years ago

The problem is with handling edge cases:

referencedev commented 3 years ago

As pointed out above: