1inchProtocol icon indicating copy to clipboard operation
1inchProtocol copied to clipboard

Add support for DMM

Open coreycaplan3 opened this issue 5 years ago • 1 comments

The interface is very similar to compound. All mTokens have the same number of decimals as their underlying counterpart. The exchangeRate is always a number with 18 decimal places, regardless of the token.

Master Controller - 0x4CB120Dd1D33C9A3De8Bc15620C7Cd43418d77E2

  • You can call #getDmmTokenIds to get all of the tokens by their ID and iterate through them, if you want. There are the respective functions in there for getting the underlying token by address or querying on the mToken address if you only have the underlying (eg DAI --> mDAI) underlyingTokenAddressToDmmTokenIdMap

mDAI -0x06301057D77D54B6e14c7FafFB11Ffc7Cab4eaa7 mETH - 0xdF9307DFf0a1B57660F60f9457D32027a55ca0B2 mUSDC - 0x3564ad35b9E95340E5Ace2D6251dbfC76098669B

Minting is as simple as calling mint(uint underlyingAmount) where underlyingAmount is the amount of underlying you want to send into the contract. Note, a token approval is needed for calling mint on the underlying contract, where the spender is set to the mToken contract address.

Redeeming mTokens for underlying, plus interest, is done through redeem(uint amount) where amount is the amount of mTokens to be sent to the contract and redeemed. Note, no token approvals are required to redeem mTokens.

coreycaplan3 avatar May 27 '20 17:05 coreycaplan3

Thanks!

k06a avatar Jun 19 '20 17:06 k06a