Why token approval is needed?
Token approval is a pretty standard approach in the web3 world. This is basically letting the blockchain know that you authorize the app or the third-party contract to use the token on your behalf. This does not mean that they can access your tokens without your permission, you will still need to approve every transaction. This is an additional step in web3 to ensure that:
- The owner of the wallet trust the application to carry out the transaction
- And to set a limit to how many tokens can each transaction use at max, think of it as a max transfer limit you set with your bank.
While trading SWAVE from the app we do the heavy lifting for you, our goal is to get you the best price for SWAVE. We use various exchanges to make sure you get the underlying assets at the best possible cost, these assets are then acquired on your behalf using your source token(MATIC/USDC). Thus since the SWAVE app is responsible for using your source token to acquire the underlying assets, we need the approval.
Approvals are usually a one time thing and can be revoked if necessary. This would mean for future transaction on the app you would need to approve the app/contracts again.
For trading on SWAVE, typically you would be asked for 2 contracts to be approved:
- Exchange Issuance ZeroEx Contract
- 0x Exchange Proxy Contract
This contract is used to issue and redeem SWAVE token. It is mainly responsible for carrying out all the trading activity for you to acquire the underlying assets and mint the SWAVE token. The reverse is done during selling/burning of a SWAVE token.
This contract is typically used for larger orders. In order to get you the best price for the token, a large order is split into smaller ones so that the price impact on your transaction is low.