MAAT Finance
  • Introduction
  • Integration
    • Deposit
    • Withdraw
    • Supported Chains
    • Supported Tokens
    • Supported Protocols
    • Widget
  • Smart Contracts
    • Architecture Overview
    • MaatVaultV1
    • MaatOracleGlobalPPS
    • MaatAddressProviderV1
    • StargateAdapter
    • Strategy
    • IncentivesController
  • Additional Info
    • Resources
    • Vision
  • Legal
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  • MaatVaultV1
  • EIP4626
  • EIP20
  • Write methods
  • requestWithdraw
  • requestRebalance
  • cancelWithdrawal
  • setWithdrawCancellationDelay
  • addRelatedVaults
  • removeRelatedVault
  • finishBridge
  • setCommander
  • setWatcher
  • addStrategy
  • removeStrategy
  • disableStrategy
  • enableStrategy
  • Read methods
  • addressProvider
  • getRelatedVault
  • idle
  • getStrategyByAddress
  • getStrategyById
  • getWithdrawRequest
  • withdrawCancellationDelay
  1. Smart Contracts

MaatVaultV1

MaatVaultV1

MaatVaultV1 makes it simple and intuitive for users to manage their assets. You can easily deposit and withdraw your funds, knowing that they’re being actively managed across multiple chains through the Stargate Adapter. The vault is designed to maximize returns by investing in different strategies and ensuring your assets are always in the right place.

Actions:

  1. User: Deposit and withdraw assets.

  2. Commander: Execute actions to distribute deposits and fulfill withdraw requests.

  3. Watcher: Trigger rebalance when needed.

EIP4626

All standard EIP4626 functions are implemented.

Due to MAAT's architecture you should avoid using withdraw and redeem. These functions will cause the transaction to fail because all assets are deposited into strategies across multiple chains. Instead, please use requestWithdraw.

EIP20

All standard EIP20 functions are implemented.

View functions like totalSupplyonly show the total amount of shares on the current chain, not the shares across all chains.

Write methods

requestWithdraw

function requestWithdraw(uint shares, uint32 dstEid, address _owner, address receiver)

Creates a request to withdraw by locking the shares in the contract, which will then be fulfilled by an off-chain service

Params

Param
Type
Description

shares

uint

Amount of shares to withdraw

dstEid

uint32

LayerZero endpoint ID for the chain where user want to get tokens

_owner

address

Address of the owner of the shares

receiver

address

Address of the receiver of the assets

Returns

Param
Type
Description

intentionId

bytes32

ID of the intention

requestRebalance

function requestRebalance()

Creates a request to rebalance assets across strategies. Only callable by the admin or watcher.

Returns

Param
Type
Description

intentionId

bytes32

ID of the intention

cancelWithdrawal

function cancelWithdrawal(bytes32 intentionId)

Cancels a withdrawal request and returns the locked shares to the owner if withdrawCancellationDelay() has passed.

Params

Param
Type
Description

intentionId

bytes32

ID of the withdrawal request

Returns

Param
Type
Description

owner

address

Address of the owner of the shares

shares

uint

Amount of shares which returns to owner

setWithdrawCancellationDelay

function setWithdrawCancellationDelay(uint timer)

Only callable by the admin. It sets the delay for the withdraw cancellation.

Params

Param
Type
Description

timer

uint

Delay for the withdraw cancellation.

addRelatedVaults

function addRelatedVaults(uint32[] calldata _dstEid, address[] calldata _vault)

Only callable by the admin. It adds related vaults that are deployed on other chains. MAAT has only one Stargate Adapter on each chain and multiple policies that may not be available on some chains, so we can only bridge assets to a chain where we have a corresponding vault.

Params

Param
Type
Description

_dstEid

uint32[]

LayerZero endpoint ID for the destination chains.

_vault

address[]

Addresses of the related vaults on the destination chains.

removeRelatedVault

function removeRelatedVault(uint32 _dstEid)

Only callable by the admin. It removes a related vault.

Params

Param
Type
Description

_dstEid

uint32

LayerZero endpoint ID for the chain.

finishBridge

function finishBridge(
        uint256 amountBridged,
        uint32 originEid,
        bytes32 intentionId
    )

Only callable by the Stargate Adapter. It is used to receive tokens from the Stargate Adapter.

Params

Param
Type
Description

amountBridged

uint256

Amount of tokens to receive.

originEid

uint32

LayerZero endpoint ID for the chain where the tokens are coming from.

intentionId

bytes32

ID of the intention.

setCommander

function setCommander(address _commander)

Only callable by the admin.

Params

Param
Type
Description

_commander

address

New commander address.

setWatcher

function setWatcher(address _watcher)

Only callable by the admin.

Params

Param
Type
Description

_watcher

address

New watcher address.

function execute(
        ActionType[] calldata actionType,
        ActionInput[] calldata inputs
    )

Executes actions: withdraw from strategy, deposit to strategy, bridge, fulfill withdrawal. Only callable by the commander or admin.

Params

Param
Type
Description

actionType

ActionType[]

Array of action types.

inputs

ActionInput[]

Array of action inputs.

addStrategy

function addStrategy(address strategy)

Only callable by the admin. Adds a new strategy which can be used to invest the assets.

Params

Param
Type
Description

strategy

address

Address of the strategy to add.

removeStrategy

function removeStrategy(bytes32 strategyId)

Only callable by the admin. Removes a strategy.

Params

Param
Type
Description

strategyId

bytes32

ID of the strategy to remove.

disableStrategy

function disableStrategy(bytes32 strategyId)

Only callable by the admin. Disables a strategy. Vault can't deposit into disabled strategies, but can withdraw from them.

Params

Param
Type
Description

strategyId

bytes32

ID of the strategy to disable.

enableStrategy

function enableStrategy(bytes32 strategyId)

Only callable by the admin. Enables a strategy.

Params

Param
Type
Description

strategyId

bytes32

ID of the strategy to enable.

Read methods

addressProvider

function addressProvider()

Returns the AddressProvider.

Returns

Type
Description

address

Address of the address provider.

getRelatedVault

function getRelatedVault(
        uint32 _dstEid
    )

Returns the address of the related vault for a given destination chain.

Params

Param
Type
Description

_dstEid

uint32

LayerZero endpoint ID for the destination chain.

Returns

Param
Type
Description

_vault

address

Address of the related vault.

idle

function idle()

Returns the idle assets. Idle Assets: Assets that are not currently invested. They are either waiting to be deposited into strategies or withdrawn by a user.

Returns

Type
Description

uint

Idle assets.

getStrategyByAddress

function getStrategyByAddress(
        address strategy
    )

Returns the strategy ID and the status of the strategy.

Params

Param
Type
Description

strategy

address

Address of the strategy.

Returns

Type
Description

bytes32

ID of the strategy.

bool

Status of the strategy, true if enabled, false if not.

getStrategyById

function getStrategyById(
        bytes32 strategyId
    )

Returns the address and the status of the strategy.

Params

Param
Type
Description

strategyId

bytes32

ID of the strategy.

Returns

Type
Description

address

Address of the strategy.

bool

Status of the strategy, true if enabled, false if not.

getWithdrawRequest

function getWithdrawRequest(
        bytes32 intentionId
    )

Returns the withdraw request info.

Params

Param
Type
Description

intentionId

bytes32

ID of the withdraw intention.

Returns

Type
Description

WithdrawRequestInfo

Withdraw request info.

withdrawCancellationDelay

function withdrawCancellationDelay()

Returns the withdrawal cancellation delay, after which the user can cancel their withdrawal request.

Returns

Type
Description

uint

Withdraw cancellation delay.

PreviousArchitecture OverviewNextMaatOracleGlobalPPS

Last updated 6 months ago