imAssets (SAVE)
imAssets are interest-bearing mAssets. They represent the deposited mAsset in SAVE and accrue in value.
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)

preDeposit()

function preDeposit (uint256 _underlying, address _beneficiary) external returns (uint256 creditsIssued)
During a migration period, allow savers to deposit underlying here before the interest has been redirected
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) 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

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

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.
Last modified 1mo ago