imAssets (SAVE)
imAssets are interest-bearing mAssets. They represent the deposited mAsset in SAVE and accrue in value.
Contracts are upgradable.
Ethereum Mainnet
Ropsten Testnet
Contract
Address
imUSD
0x5b7f01dAe6BCE656c9cA4175Eb3E406ADC6c7957
imBTC
0xBfe31D984d688628d06Ae2Da1D640Cf5D9e242A5
Both imAssets (imUSD and imBTC) follow the ERC20 standard. The non-standard decreaseAllowance and increaseAllowance functions have been added to mitigate the well-known issues around setting allowances. These are based on the OpenZeppelin ERC20 implementation.
The following list describes functions that are part of this implementation and cover both assets.

ERC-20 Functions

totalSupply()

function totalSupply () external returns (uint256)
Returns the amount of tokens in existence.

balanceOf()

function balanceOf () external returns (uint256)
Returns the amount of tokens owned by account.

transfer()

function transfer () external returns (bool)
Moves amount tokens from the caller's account to recipient.
Returns a boolean value indicating whether the operation succeeded.
Emits a {Transfer} event.

allowance()

function allowance () external returns (uint256)
Returns the remaining number of tokens thatspenderwill be allowed to spend on behalf ofownerthrough {transferFrom}. This is zero by default.
This value changes when {approve} or {transferFrom} are called.

approve()

function approve () external returns (bool)
Sets amount as the allowance of spender over the caller's tokens.
Returns a boolean value indicating whether the operation succeeded.
IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
Emits an {Approval} event.

transferFrom()

function transferFrom () external returns (bool)
Moves amount tokens from sender to recipient using the allowance mechanism. amount is then deducted from the caller's allowance.
Returns a boolean value indicating whether the operation succeeded.
Emits a {Transfer} event.

increaseAllowance()

function increaseAllowance () public returns (bool)
Atomically increases the allowance granted to spender by the caller.
This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.
Emits an {Approval} event indicating the updated allowance.
Requirements:
  • spender cannot be the zero address.

decreaseAllowance()

function decreaseAllowance () public returns (bool)
Atomically decreases the allowance granted to spender by the caller.
This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.
Emits an {Approval} event indicating the updated allowance.
Requirements:
  • spender cannot be the zero address.
  • spender must have allowance for the caller of at least
    subtractedValue.

Save functions

balanceOfUnderlying()

function balanceOfUnderlying (address _user) external returns (uint256 balance)
Returns the underlying balance of a given user
Parameter
Type
Description
_user
address
Address of the user to check

underlyingToCredits()

function underlyingToCredits (uint256 _underlying) external returns (uint256 credits)
Converts a given underlying amount into credits
Parameter
Type
Description
_underlying
uint256
Units of underlying

creditsToUnderlying()

function creditsToUnderlying (uint256 _credits) external returns (uint256 amount)
Converts a given credit amount into underlying
Parameter
Type
Description
_credits
uint256
Units of credits

creditBalances()

Deprecated in favour of `balanceOf(address)`. Maintained for backwards compatibility. Returns the credit balance of a given user
function creditBalances (address _user) external returns (uint256)

depositSavings()

function depositSavings (uint256 _underlying) external returns (uint256 creditsIssued)
Deposit the senders savings to the vault, and credit them internally with "credits". Credit amount is calculated as a ratio of deposit amount and exchange rate: credits = underlying / exchangeRate We will first update the internal exchange rate by collecting any interest generated on the underlying.
Parameter
Type
Description
_underlying
uint256
Units of underlying to deposit into savings vault

depositSavings()

function depositSavings (uint256 _underlying, address _beneficiary) external returns (uint256 creditsIssued)
Deposit the senders savings to the vault, and credit them internally with "credits". Credit amount is calculated as a ratio of deposit amount and exchange rate: credits = underlying / exchangeRate We will first update the internal exchange rate by collecting any interest generated on the underlying.
Parameter
Type
Description
_underlying
uint256
Units of underlying to deposit into savings vault
_beneficiary
address
Immediately transfer the imUSD token to this beneficiary address

depositSavings()

function depositSavings (uint256 _underlying, address _beneficiary, address _referrer) external returns (uint256 creditsIssued)
Overloaded depositSavings method with an optional referrer address.
Parameter
Type
Description
_underlying
uint256
Units of underlying to deposit into savings vault. eg mUSD or mBTC
_beneficiary
address
Address to the new credits will be issued to.
_referrer
address
Referrer address for this deposit.

redeem()

function redeem () external returns (uint256 massetReturned)

redeemCredits()

function redeemCredits (uint256 _credits) external returns (uint256 massetReturned)
Redeem specific number of the senders "credits" in exchange for underlying. Payout amount is calculated as a ratio of credits and exchange rate: payout = credits * exchangeRate
Parameter
Type
Description
_credits
uint256
Amount of credits to redeem

redeemUnderlying()

function redeemUnderlying (uint256 _underlying) external returns (uint256 creditsBurned)
Redeem credits into a specific amount of underlying. Credits needed to burn is calculated using: credits = underlying / exchangeRate
Parameter
Type
Description
_underlying
uint256
Amount of underlying to redeem

redeemAndUnwrap()

function redeemAndUnwrap (uint256 _amount, bool _isCreditAmt, uint256 _minAmountOut, address _output, address _beneficiary, address _router, bool _isBassetOut) external returns (uint256 creditsBurned, uint256 massetReturned, uint256 outputQuantity)
Redeem credits into a specific amount of underlying, unwrap into a selected output asset, and send to a beneficiary Credits needed to burn is calculated using: credits = underlying / exchangeRate
Parameter
Type
Description
_amount
uint256
Units to redeem (either underlying or credit amount).
_isCreditAmt
bool
true if amount is in credits. eg imUSD. false if amount is in underlying. eg mUSD.
_minAmountOut
uint256
Minimum amount of output tokens to unwrap for. This is to the same decimal places as the output token.
_output
address
Asset to receive in exchange for the redeemed mAssets. This can be a bAsset or a fAsset. For example: - bAssets (USDC, DAI, sUSD or USDT) or fAssets (GUSD, BUSD, alUSD, FEI or RAI) for mainnet imUSD Vault. - bAssets (USDC, DAI or USDT) or fAsset FRAX for Polygon imUSD Vault. - bAssets (WBTC, sBTC or renBTC) or fAssets (HBTC or TBTCV2) for mainnet imBTC Vault.
_beneficiary
address
Address to send output tokens to.
_router
address
mAsset address if the output is a bAsset. Feeder Pool address if the output is a fAsset.
_isBassetOut
bool
true if output is a bAsset. false if output is a fAsset.

poke()

function poke () external
External poke function allows for the redistribution of collateral between here and the current connector, setting the ratio back to the defined optimal.