Router Contract
As some of you might be aware, we have been developing a router contract to improve UX when interacting with the protocol. Essentially, it allows to combine multiple actions into one transaction when interacting with the protocol’s contracts, opening the door for new functionalities. The downside is that it creates a one-stop contract for a lot of protocol interactions.
General Functionality
As said above, the goal of this contract is to combine actions to improve user experience. For example, we could imagine features like depositing collateral + staking or claiming interest + staking.
With the current draft implementation, almost any combinations of the following actions can be performed:
- Claiming all rewards from gauges of types 0 & 1
- Claming weekly interest
- Depositing tokens into a gauge (staking)
- Minting agEUR
- Depositing collateral against sanTokens
- Withdrawing tokens from sanTokens
- Opening a perpetual position
- Adding collateral to a position
Additionally, these actions could be performed from any token, as the router includes a function to swap through UniswapV3 or 1Inch into one of the accepted collateral.
Use Cases
In general, any use cases combining the actions listed above can be performed. However, not all of them will be implemented in the app.
We are currently working on integrating the most convenient ones, among which:
- Claim All ANGLE rewards: ability to claim all rewards from gauges 0 & 1 in one transaction
- Deposit collateral & stake: ability to deposit collateral into the protocol, and stake on the corresponding liquidity gauge at the same time. This could also potentially be done from any token.
- Claim Weekly Interest and Stake: ability to claim the weekly distributed sanUSDC/EUR and stake them directly in the associated gauge.
- Claim Weekly Interest and Mint: ability to claim the weekly distributed sanUSDC/EUR and mint agEUR directly in one transaction.
- Mint from any token: allow users to mint agEUR using any token that can be swapped against one of the accepted collateral through UniswapV3 or 1Inch.
- OpenPerp from any token: allow users to open perpetuals using any token that can be swapped against one of the accepted collateral through UniswapV3 or 1Inch.
Technical Details
mixer()
function
The router is written such that there is a mixer()
function that can be called with a set of arguments, including the different actions it can perform and their parameters.
This will be detailed in the developers docs as soon as we make the contract public, a few days before deployment.
Permit signature VS approval transaction
To allow contracts to spend funds, users are usually required to sign an approval transaction. The router changes that by using the permit signature from the EIP-2912 instead of an approval transaction, reducing gas cost and waiting time for users. Note that this is only available for tokens which contracts contain the permit()
function.
Ideally, users would need to sign a message before each transaction to approve the spending of the required amount of funds.
The goal is to make these use cases available as soon as possible, while making sure that the contract is thoroughly tested and verified.
Let us know your thoughts!