This method is used to lend money to different lending providers. When you call mintIdleToken we will transfer the amount of underlying supplied to IdleToken contract and then mint interest-bearing tokens with that amount. Interest-bearing tokens of each user are pooled together inside the IdleToken contract and you will then receive IdleTokens which represent your share of Idle pools.

This method triggers a rebalance of the whole pool if needed. This would generate an aggregated interest rate which is the highest one available for every user that uses Idle.

User should call approve on the underlying asset used (eg. DAI) to allow IdleToken contract to spend _amount of tokens before calling this method.

NOTE: after the first mint all subsequent ones will also send governance tokens (eg IDLE) to msg.sender (if msg.sender had other previously minted idleTokens in the account)

function mintIdleToken(uint256 _amount, bool _skipWholeRebalance, address _referral) external returns (uint256 mintedTokens);
  • _amount : amount of underlying token to be lent

  • _skipWholeRebalance : whether to skip the rebalance or not, in our client we set this flag to false (ie do the rebalance) when the minted amount is > then a threshold (currently 2k equivalent value in $) to keep allocations up to date

  • _referral: address for eventual future referral program

  • RETURN mintedTokens : amount of IdleTokens minted