Mint
Minting
This page explains the process of minting a branded stablecoin by depositing a supported asset into a vault contract.
Note that the terms "vault token", "vault shares", or "stablecoin" are all synonymous, as a stablecoin is also simply a tokenized share of a vault.
Transaction Flow
Wallet
A
has some balance oftokenA
Optionally, to confirm whether
tokenA
can be deposited to theBoringVault
, queryTeller.isSupported(tokenA)
. If true,tokenA
can be deposited to the vault.
Approve the
BoringVault
contract to transfertokenA
.The
BoringVault
contract is the ERC20 stablecoin contract itself.
Call
Teller.deposit(...)
The
deposit
function will atomically transfer yourtokenA
into theBoringVault
and mint to WalletA
a share of the stablecoin token.
Functions
isSupported
isSupported
Returns whether a certain asset is depositable or not.
/**
* @notice Mapping ERC20s to an isSupported bool.
*/
mapping(ERC20 => bool) public isSupported;
See Example Code
deposit
deposit
Allows users to deposit an asset and mint the vault token. Reverts if the contract is paused.
Publicly callable.
function deposit(
ERC20 depositAsset,
uint256 depositAmount,
uint256 minimumMint
)
external
requiresAuth
nonReentrant
returns (uint256 shares);
Function Parameters
depositAsset
The address of the asset that you are depositing to mint the stablecoin.
depositAmount
The amount of the
depositAsset
that you are depositing, in thedepositAsset
's decimals.
minimumMint
The minimum amount of the stablecoin that you want to receive as a result of the deposit.
See Example Code
depositWithPermit
depositWithPermit
Allows users to deposit into the vault using permit
which allows off-chain signature based approvals. This function removes the need for a separate approval transaction.
Publicly callable.
function depositWithPermit(
ERC20 depositAsset,
uint256 depositAmount,
uint256 minimumMint,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
)
external
requiresAuth
nonReentrant
returns (uint256 shares);
Function Parameters
depositAsset
The address of the asset that you are depositing to mint the stablecoin.
depositAmount
The amount of the
depositAsset
that you are depositing, in thedepositAsset
's decimals.
minimumMint
The minimum amount of the stablecoin that you want to receive as a result of the deposit.
deadline
The time after which your permit signature will expire.
v, r, s
The permit signature.
See Example Code
Last updated