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.
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
Vault Actions
setBaker
Sets a baker for the vault to earn XTZ rewards
setBaker
setBakerType: option(key_hash)
Key hash of the baker
delegateToSatellite
Delegates the vault to a designated satellite
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.
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.
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.
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
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.
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
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
Last updated