[IIP-7] IdleToken upgrade + stkAAVE distribution


@william @Teo


The purpose of this proposal is to introduce a number of improvements and new features for the Idle protocol. This upgrade comprehends flash loan support, improved integration tools and methods, gas optimization, and stkAAVE farming support.


The rationale for this proposal is motivated by the following objectives:

  • Boosted APYs for users thanks to flash loans fees

  • General gas optimization redeems

  • Improved integration experience and set up for integrators

  • stkAAVE implementation as new farmed token for users

  • Re-enable COMP rewards for WBTC strategy and migrate to the new Compound pool because the old one will be deprecated in few days


For the last month, the Idle Labs team has been developing, testing, and reviewing different new features that are needed for improving protocol UX for both retail and businesses, adding flash loans support, Aave/Compound compatibility upgrades, and general gas optimization. Most of these improvements have been already audited by Quantstamp (latest audit report here) and would be ready to be proposed on-chain and voted by our community.

Flash loans are part of the Idle Community Roadmap, and some aspects have already been discussed in the forum. Compound cTokens architecture migration has been already examined by the community, and so does Aave LM program implementation. Community sentiment about these initiatives has been positive so far.

High level overview:

Upgrade of IdleTokenGovernance contract to include the following changes:

  • support for EIP 3165 flashLoans (fee is set to 0.08% of the flash loaned amount redistributed to LP)

  • support for stkAAVE distribution

  • support for new cWBCT distribution

  • other minor updates for gas and redeems (see more below)


On a technical side, the audit covered the following changes (that can be found here):

  • Add EIP-3165 compliant flash loan support, default fee set at 0.08%

  • Add new methods: flashFee, maxFlashLoan, flashLoan

  • Integrated Emiliano Bonassi’s price helper in the main IdleToken contract directly with the tokenPriceWithFee view method (refactored a bit)

  • updated setAllAvailableTokensAndWrappers method to allow setting

  • supported governance tokens in a single call (useful for updating cWBTC to the new version and also the new version of cUSDC and cETH)

  • added setCToken method that allows to change the cToken address associated with COMP distribution (always for supporting the new version of cTokens)

  • added redeemIdleTokenSkipGov which allow to not redeem specific gov tokens in exchange for a gas reduction (estimated gas cost reductions in fork: 10-20% compared to a normal redeem, based on how many gov tokens (ie 1 or 2 for now for COMP or IDLE) one is willing to forfeit)

  • added getGovTokens view method

  • added getAllAvailableTokens view method

  • added getProtocolTokenToGov view method

  • removed userNoFeeQty

  • removed setGovTokens (integrated in setAllAvailableTokensAndWrappers)

  • removed all GST2 methods

  • removed rebalanceWithGST

  • removed setIsRiskAdjusted

  • removed openRebalance

  • added IdleTokenHelper contract (referenced inside the main IdleTokenGovernance contract for some view methods to reduce the bytecode size of the main contract)

  • code refactoring for reducing bytecode size and gas costs where possible (estimated gas cost reductions in fork: 2-5% on mint, 40% when redeeming only governance tokens)

The only component that has not been included in the latest audit scope is the stkAAVE support. The required changes for the main contract are minimal and fully tested and can be found here for IdleTokenGovernance and here for IdleTokenHelper, and can be summarized as follow:

  • Added setAToken method

  • snippet to support stkAAVE distribution in IdleTokenHelper and PriceOracle

  • Updating the oracle address added with the new PriceOracle (deployed here, added a getStkAaveApr here)

Regarding stkAAVE distribution schedule, more information can be found in Aave’s AIP-16.

Proposal Process

The actual implementation and full deployment of IIP-7 would need to take place with 2 different on-chain proposals (as the required actions are more than 10).

The first on-chain proposal will include [Github link]:

  • upgrade DAI, USDC, USDT, WBTC, WETH Best yield strategies with the new implementation (5 actions)

  • support for new cWBTC distribution + stkAAVE distribution + disable cWBTC v1 (2 actions)

  • support for stkAAVE distribution in DAI, USDC, USDT (3 actions)

(WETH will accrue stkAAVE but will not redistribute them to the user until the next proposal is passed).

The second on-chain proposal will include (implementation link TBD):

  • support for stkAAVE distribution in WETH (1 action)

  • upgrade SUSD, TUSD Best yield strategies with the new implementation (2 actions)

  • _setPriceOracle in IdleController **

** in order to support the stkAAVE distribution a new priceOracle has been deployed here, this will be automatically set upon the IdleToken upgrade, but it should be updated also in the IdleController (the contract used for IDLE distribution). A separate proposal is needed probably to call _setPriceOracle there because it triggers a refreshIdleSpeeds which is really costly and should be associated with low-gas actions. Few more tests are needed on this.

cWBTC v1 has already been paused and the rebalancer will no longer allocate new funds there until the proposal 1 is passed with the new cWBTC v2. The rebalancer already also started including the stkAAVE apr in the rebalances so allocations now consider also stkAAVE rewards.

Those rewards will accrue to the contract until proposal 1 is passed, and at that point, rewards will be redistributed to users on mint and redeem events as with COMP and IDLE.

Next Steps

We are going to leave this thread open for comments regarding this implementation, and in about 24/48hrs, if there are no objections, we will proceed with the on-chain proposal and the voting phase.


I don’t have much feedback.

Just wanted to say thanks for taking the time to explain and lay out everything nicely.

I see all pros and absolutely zero cons.

IDLE’s about to take things up another notch. Going to catch many off guard :star_struck: :crazy_face:

Its been 24h. Let’s start the vote :sunglasses: :100: :boom:


Thank you for the detailed summary. The motivations seem very aligned to the roadmap and are items that have been discussed in various threads on the forum. All paths lead to a better user experience and outcome. :slight_smile:

Just as a side point on the Flash Loans: I see Aave have integrations with some low/no-code interfaces like Collateral Swap, DeFi Saver and Furu Combo, I am not sure on the amount of traction they see through these channels but it could be something to consider in the near future to improve the ease of adoption and integration.


Following up on my side note. According to this Tweet, the largest FlashLoan user is Defi Saver (link).


Some articles/guides and strategical integrations will for sure help the adoption of Idle flash loans and I think the new Dev and Treasury leagues can speed up the process on this side


The first on-chain proposal (1/2) for this IIP-7 that will:

  • upgrade DAI, USDC, USDT, WBTC, WETH Best yield strategies with the new idleToken implementation (gas optimization)
  • support for new cWBTC distribution + stkAAVE distribution + disable cWBTC v1
  • support for stkAAVE distribution for DAI, USDC, USDT

is now live and receiving votes: VOTE HERE! :ballot_box::fire:

(Voting window will last until May 6th, 2021 @ 09:38 AM UTC)


First part of IIP-7 got queued :raised_hands:


In two days, the proposal can be executed and the improvements & changes will be live!


The second part of the planned on-chain proposal would include the actions reported above, but here we’d like to introduce a minor change that could reduce rebalance costs up to 20-30%, according to simulations.

This improvement requires minimum code changes and only to the rebalance method, but the saved fees would be consistent (out of 60 ETH spent in 4 months by the rebalancer, the protocol can save up to 30-40 ETH annually).

Changes are presented here (the new implementation will be deployed tomorrow): Github link

Furthermore, this proposal includes 2 actions related to Leagues’ budget transfer, with the updated value reported by Emiliano:

  • 6.38 ETH from FeeTreasury to Dev League address (0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b)

  • 11,008 IDLE from Ecosystem Fund to Treasury League (0xFb3bD022D5DAcF95eE28a6B07825D4Ff9C5b3814)

The updated list of actions for the next on-chain proposal would be the following:

  • support for stkAAVE distribution in WETH ( 1 action )

  • upgrade all Best-Yield strategies with the gas-saving improvement and upgrade SUSD, TUSD Best-Yield strategies with the new implementation ( 7 actions )

  • 6.38 ETH transferred from FeeTreasury to Dev League address ( 1 action )

  • 11,008 IDLE from Ecosystem Fund to Treasury League ( 1 action )

The second part of IIP-7 will be open for comments for 24/48hrs, and if no observations are reported, we will proceed with the on-chain proposal and the voting phase.


The new implementation has been deployed here → 0xd133552be9724b501e1ee9c257e34e07317b5db6


The proposal is now live ! Cast your vote :arrow_right: HERE :arrow_left:

Tx: Ethereum Transaction Hash (Txhash) Details | Etherscan