Save Wrapper

The Save Wrapper bundles utility functions together to simplify multiple interactions with mStable's smart contract calls into one single call. This contract is immutable.

Functions

saveAndStake()

function saveAndStake (address _mAsset, address _save, address _vault, uint256 _amount) external

Simply saves an mAsset and then into the vault

ParameterTypeDescription

_mAsset

address

mAsset address

_save

address

Save address

_vault

address

Boosted Savings Vault address

_amount

uint256

Units of mAsset to deposit to savings

saveAndStake()

function saveAndStake (address _mAsset, address _save, address _vault, uint256 _amount, address _referrer) external

Simply saves an mAsset and then into the vault

ParameterTypeDescription

_mAsset

address

mAsset address

_save

address

Save address

_vault

address

Boosted Savings Vault address

_amount

uint256

Units of mAsset to deposit to savings

_referrer

address

Referrer address for this deposit.

saveViaMint()

function saveViaMint (address _mAsset, address _bAsset, address _save, address _vault, uint256 _amount, uint256 _minOut, bool _stake) external

Mints an mAsset and then deposits to Save/Savings Vault

ParameterTypeDescription

_mAsset

address

mAsset address

_bAsset

address

bAsset address

_save

address

Save address

_vault

address

Boosted Savings Vault address

_amount

uint256

Amount of bAsset to mint with

_minOut

uint256

Min amount of mAsset to get back

_stake

bool

Add the imAsset to the Boosted Savings Vault?

saveViaMint()

function saveViaMint (address _mAsset, address _bAsset, address _save, address _vault, uint256 _amount, uint256 _minOut, bool _stake, address _referrer) external

Mints an mAsset and then deposits to Save/Savings Vault

ParameterTypeDescription

_mAsset

address

mAsset address

_bAsset

address

bAsset address

_save

address

Save address

_vault

address

Boosted Savings Vault address

_amount

uint256

Amount of bAsset to mint with

_minOut

uint256

Min amount of mAsset to get back

_stake

bool

Add the imAsset to the Boosted Savings Vault

_referrer

address

Referrer address for this deposit.

saveViaSwap()

function saveViaSwap (address _mAsset, address _save, address _vault, address _feeder, address _fAsset, uint256 _fAssetQuantity, uint256 _minOutputQuantity, bool _stake) external

Swaps fAsset for mAsset and then deposits to Save/Savings Vault

ParameterTypeDescription

_mAsset

address

mAsset address

_save

address

Save address

_vault

address

Boosted Savings Vault address

_feeder

address

Feeder Pool address

_fAsset

address

fAsset address

_fAssetQuantity

uint256

Quantity of fAsset sent

_minOutputQuantity

uint256

Min amount of mAsset to be swapped and deposited

_stake

bool

Deposit the imAsset in the Savings Vault?

saveViaSwap()

function saveViaSwap (address _mAsset, address _save, address _vault, address _feeder, address _fAsset, uint256 _fAssetQuantity, uint256 _minOutputQuantity, bool _stake, address _referrer) external

Swaps fAsset for mAsset and then deposits to Save/Savings Vault

ParameterTypeDescription

_mAsset

address

mAsset address

_save

address

Save address

_vault

address

Boosted Savings Vault address

_feeder

address

Feeder Pool address

_fAsset

address

fAsset address

_fAssetQuantity

uint256

Quantity of fAsset sent

_minOutputQuantity

uint256

Min amount of mAsset to be swapped and deposited

_stake

bool

Deposit the imAsset in the Savings Vault?

_referrer

address

Referrer address for this deposit.

saveViaUniswapETH()

function saveViaUniswapETH (address _mAsset, address _save, address _vault, address _uniswap, uint256 _amountOutMin, address[] _path, uint256 _minOutMStable, bool _stake) external

Buys a bAsset on Uniswap with ETH, then mints imAsset via mAsset, optionally staking in the Boosted Savings Vault

ParameterTypeDescription

_mAsset

address

mAsset address

_save

address

Save address

_vault

address

Boosted vault address

_uniswap

address

Uniswap router address

_amountOutMin

uint256

Min uniswap output in bAsset units

_path

address[]

Sell path on Uniswap (e.g. [WETH, DAI])

_minOutMStable

uint256

Min amount of mAsset to receive

_stake

bool

Add the imAsset to the Savings Vault?

saveViaUniswapETH()

function saveViaUniswapETH (address _mAsset, address _save, address _vault, address _uniswap, uint256 _amountOutMin, address[] _path, uint256 _minOutMStable, bool _stake, address _referrer) external

Buys a bAsset on Uniswap with ETH, then mints imAsset via mAsset,optionally staking in the Boosted Savings Vault

ParameterTypeDescription

_mAsset

address

mAsset address

_save

address

Save address

_vault

address

Boosted vault address

_uniswap

address

Uniswap router address

_amountOutMin

uint256

Min uniswap output in bAsset units

_path

address[]

Sell path on Uniswap (e.g. [WETH, DAI])

_minOutMStable

uint256

Min amount of mAsset to receive

_stake

bool

Add the imAsset to the Savings Vault?

_referrer

address

Referrer address for this deposit.

estimate_saveViaUniswapETH()

function estimate_saveViaUniswapETH (address _mAsset, address _uniswap, uint256 _ethAmount, address[] _path) external returns (uint256 out)

Gets estimated mAsset output from a WETH > bAsset > mAsset trade

ParameterTypeDescription

_mAsset

address

mAsset address

_uniswap

address

Uniswap router address

_ethAmount

uint256

ETH amount to sell

_path

address[]

Sell path on Uniswap (e.g. [WETH, DAI])

Last updated