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

  1. Wallet A has some balance of tokenA

    1. Optionally, to confirm whether tokenA can be deposited to the BoringVault, query Teller.isSupported(tokenA). If true, tokenA can be deposited to the vault.

  2. Approve the BoringVault contract to transfer tokenA.

    1. The BoringVault contract is the ERC20 stablecoin contract itself.

  3. Call Teller.deposit(...)

  4. The deposit function will atomically transfer your tokenA into the BoringVault and mint to Wallet A a share of the stablecoin token.

Functions

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

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 the depositAsset's decimals.

  • minimumMint

    • The minimum amount of the stablecoin that you want to receive as a result of the deposit.

See Example Code

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 the depositAsset'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