All-in-one Proxy

As previously stated, users need to implement the following two steps while realizing a fixed interest rate.

  1. Deposit or lend on Aave

  2. Buy a corresponding amount of Long or Short tokens on iGain

To simplify the operation, we provide an all-in-one service for users to directly borrow or lend on Aave and buy a corresponding amount of Long and Short tokens via proxy contracts on iGain interface. Our solution helps users to complete all steps in one single transaction and skip the relevant calculation.

In summary, this service has two advantages.

  1. Efficiency: Users do not need to switch among two platforms.

  2. Ease of Use: Users can complete one-click purchase instead of calculating the purchased amount by themselves.

In the following, we will introduce all-in-one services and the mechanism of proxy contracts. So far, we support both fixed APY lending and borrowing.

Fixed APY Lending:

In general, to realize fixed rate lending on iGain, users need to prepare two types of capital: one is to deposit to Aave, and the other is to buy Short tokens. With this all-in-one solution, users merely need to decide the total amount of deposit to Aave and the system can estimate the sum of spendings based on the capital. Through proxy contracts, a transaction contains two steps:

  1. Deposit partial capital to Aave to earn interests

  2. Partial capital to buy Short tokens in order to hedge against interest rate and lock future yield

The calculation is as follows:

Given that users want to deposit A USDC on Aave and need extra spending x USDC to buy Short tokens (with leverage level leverage.

To hedge against the loan interest rate, users need to buy A/leverage of Short tokens.

According to mintExactA(y/leverage)* , the cost x to buy Short tokens can be estimated.

x=mintExactA(xleverage)x = mintExactA(\frac{x}{leverage})

With this function, x can be calculated and through proxy, users can directly deposit and call mintA(x) to buy Short tokens. Meanwhile, the system will help users deposit A to Aave and get interest rates.

In summary, this function fits the need of users wanting to have fixed-rate deposit on Aave. In this way, users merely need to decide on the deposit amount and can complete one-click estimation and purchase.

Fixed APY Borrowing

Similarly, in the case DeFi users want to have fixed-rate loans, they need to deposit collateral on Aave to borrow crypto assets from the protocol and buy a corresponding amount of Long tokens on iGain IRS.

After depositing collateral beforehand on a DeFi platform (Aave, etc), users can complete one-click borrowing via proxy smart contracts on iGain IRS.

With those proxy contracts, iGain IRS' system can calculate borrowing amount based on users' Loan to Value (LTV) on Aave, estimate the needed amount of Long tokens and implement the following steps in one transaction:

  1. Borrow from Aave

  2. Partial loan to buy Long tokens to hedge position and lock future borrowing costs

The calculation is as follows:

Given that users borrow A USDC from Aave and x USDC will be used to buy Long tokens to hedge loan interest rate and fix the future borrowing costs (with leverage level leverage.

To hedge against loan interest rates, users need to buy x/leverage on Long tokens.

We can estimate purchasing costs y by mintExactB(x/leverage)* and call mintB(y)through the proxy to buy Long tokens and implement loans.

The rest of the capital is A - y, which means the actual borrowing capital users can use after buying Long tokens.

Notably, although Long tokens can hedge against the value change in loan position, these two are independent and technically disconnected positions. Hence, if the value of the collateral goes down or the borrowing rate surges, users still face the risks of forced liquidation. Please note the collateral rate and potential margin calls.

In conclusion, this function provides a user-friendly approach for users wanting to obtain fixed-rate loans. This solution directly aggregates Aave's borrowing function to the iGain interface and enables users to complete one-click purchase.

Remarks:

  1. mintExactB() and mintExactA() can calculate the costs of purchasing a specific amount of Long or Short tokens. Read more in source code and HackMD.

Last updated