Maven Finance Docs
  • Introduction
    • Getting Started
  • Maven Finance
    • Staking
      • Benefits and Fees of Staking
      • How To Stake and Unstake
    • Satellites & Oracles
      • Delegating To Satellites
      • Satellite Registration
      • Oracle Nodes
    • Earn & Borrow
      • Lending & mTokens
      • Multi-Collateral Vaults
        • Liquidation
      • Interest Rate Model
    • Yield Farms
      • Maven Finance's Yield Farms
      • Yield Farming Dashboard
    • Governance
      • Governance Rounds
        • Proposal Round
        • Voting Round
        • Timelock Round
      • Emergency Governance
      • Financial Governance
      • Satellite Governance
    • Council
      • Management of Finances
      • Management of Vestees
    • Treasury
  • Smart Contracts
    • Smart Contracts Overview
      • Doorman Contract
      • Delegation Contract
      • Aggregator Contract
      • Aggregator Factory Contract
      • Farm Contract
      • Farm Factory Contract
      • Governance Contract
      • Governance Financial Contract
      • Governance Satellite Contract
      • Governance Proxy Contract
      • Council Contract
      • Treasury Contract
      • Treasury Factory Contract
      • Break Glass Contract
      • Emergency Governance Contract
      • Lending Controller Contract
      • Vault Contract
      • Vault Factory Contract
      • MVN Token Contract
      • mToken Contract
      • Vesting Contract
  • Glossary
    • Glossary of Terms
Powered by GitBook
On this page
  • Vault Entrypoints
  • Vault Actions
  • View Methods
  1. Smart Contracts
  2. Smart Contracts Overview

Vault Contract

Unlock Your Assets' Potential with Maven Vaults

The Vault Contract stands as a cornerstone of Maven Finance's flexible, multi-collateral borrowing system. It oversees the operation of Maven's innovative vaults, enabling users to unlock the potential of their assets in a secure and efficient manner.

This contract handles the deposit and withdrawal of collateral, manages depositors into the vault, as well as the setting of bakers or Satellites.

With the Vault Contract, Maven Finance provides its users a seamless and robust platform for leveraging their digital assets.

Vault Entrypoints

initVaultAction

function initVaultAction(initVaultActionType vaultAction)

The main vault entrypoint which handles the logic of vault actions through lambdas.

This implementation helps to reduce the contract and storage size of the vaults, thereby reducing the costs involved in creating new vaults and interacting with existing vaults.

Param Name
Type
Description

vaultAction

initVaultActionType: | setBakerType SetBaker | delegateToSatelliteType DelegateToSatellite | depositType Deposit | withdrawType Withdraw | onLiquidateType OnLiquidate | updateDepositorType UpdateDepositor | updateTokenOperatorsType UpdateTokenOperators | string UpdateVaultName

A variant to specify the user's action in interacting with the given vault

Each vault action will be further described below

Vault Actions

setBaker

Sets a baker for the vault to earn XTZ rewards

Can be called only by the Vault Owner

Param Name
Type
Description

setBaker

setBakerType: option(key_hash)

Key hash of the baker

delegateToSatellite

Delegates the vault to a designated satellite

Can be called only by the Vault Owner

Param Name
Type
Description

delegateToSatellite

delegateToSatelliteType: address

Address of the satellite to delegate the vault to

deposit

Deposits collateral tokens into the vault. Deposits will be registered on the Lending Controller.

Can be called only by the Vault Owner or a Whitelisted Depositor

Param Name
Type
Description

deposit

depositType: nat amount, string tokenName

Deposit params

amount

nat

Total amount of collateral tokens to deposit

tokenName

string

Name of the collateral token to deposit

withdraw

Withdraws collateral tokens from the vault. Withdrawals will be registered on the Lending Controller.

Can be called only by the Vault Owner

Param Name
Type
Description

withdraw

withdrawType: nat amount, string tokenName

Withdraw params

amount

nat

Total amount of collateral tokens to withdraw

tokenName

string

Name of the collateral token to withdraw

onLiquidate

Liquidates tokens in the vault during a liquidation event called from the Lending Controller.

Can be called only by the Lending Controller

Param Name
Type
Description

onLiquidate

onLiquidateType:

address receiver, nat amount, string tokenName

onLiquidate params sent from the Lending Controller

receiver

address

Receiver of liquidated collateral tokens

amount

nat

Total amount of collateral tokens to be liquidated

tokenName

string

Name of the collateral token to liquidated

updateDepositor

Updates the whitelist depositors of the vault

Can be called only by the Vault Owner

Param Name
Type
Description

updateDepositor

updateDepositorType:

updateDepositorAllowanceType allowance, unit empty

Update depositor params

allowance

updateDepositorAllowanceType: | bool Any | (bool * address) Whitelist

Specify the depositor allowance type of the vault

any

bool

If set to true, then anyone can deposit into the vault

whitelist

bool * address

If the boolean is set to true, the given address will be a whitelisted depositor of the vault. Conversely, if the boolean is set to false, the whitelisted depositor will be removed.

updateTokenOperators

Updates the token operators of the vault. The given collateral token will have to be a valid staked token registered on the Lending Controller.

Can be called only by the Vault Owner

Param Name
Type
Description

updateTokenOperators

updateTokenOperatorsType:

string tokenName, updateOperatorsType updateOperators

Update token operators params

tokenName

string

The name of the collateral token

updateOperators

updateOperatorsType: list(updateOperatorVariantType updateOperatorVariant)

List of operator variants

updateOperatorVariant

updateOperatorVariantType: | operatorParameterType Add_operator | operatorParameterType Remove_operator

Specify whether an operator should be added or removed

Add_operator

operatorParameterType: address owner, address operator, nat tokenId

Authorises an operator to act on behalf of the owner for the given token id

Remove_operator

operatorParameterType: address owner, address operator, nat tokenId

Removes the authority of an operator to act on behalf of the owner for the given token id

owner

address

Address of the vault owner

operator

address

Address of the operator to be authorized

tokenId

nat

Id of the token where the operator will be set

updateVaultName

Updates the reference name of the vault

Can be called only by the Vault Owner

Param Name
Type
Description

updateVaultName

string

New reference name of the vault

View Methods

getVaultHandle

function getVaultHandle()

Returns the record of the vault handle containing the vault Id and the vault owner address

getVaultName

function getVaultName()

Returns the reference name of the vault

getVaultDepositors

function getVaultDepositors()

Returns the depositor type and whitelisted depositor set of the vault if any

PreviousLending Controller ContractNextVault Factory Contract

Last updated 6 months ago