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
  • Write functions
  • sendTokens
  • lzCompose
  • depositOnSrcChain
  • withdraw
  • sweep
  • setDstAdapter
  • setStargate
  • setLzExtraOptions
  • Read functions
  • isDstAdapterExists
  • getDstAdapter
  • getStargateByToken
  1. Smart Contracts

StargateAdapter

StargateAdapter is a contract that vaults use to interact and bridge assets between chains through Stargate.

Write functions

sendTokens

function sendTokens(
        address _vault,
        uint32 _dstEid,
        address _token,
        uint _amountLD,
        bytes32 _intentionId
    )

MAAT vault call this function to send tokens to vault on other chain. Only callable by the vault or admin.

Params

Param
Type
Description

_vault

address

Address of the destination vault

_dstEid

uint32

LayerZero endpoint ID for the destination chains.

_token

address

Address of the token to be sent

_amountLD

uint

Amount of tokens to be sent

_intentionId

bytes32

Intention id

function sendTokensToReceiver( uint32 _dstEid, address _token, uint _amountLD, address _receiver )

If a user creates a withdrawal request on one chain but wants to receive the tokens on another chain, they can specify the dstEid. The vault will send the tokens to the user through the StargateAdapter by calling this function. Only callable by the vault or admin.

Params

Param
Type
Description

_dstEid

uint32

LayerZero endpoint ID for the destination chains.

_token

address

Address of the token to be sent

_amountLD

uint

Amount of tokens to be sent

lzCompose

function lzCompose(...)

Function to call by LayerZero.

depositOnSrcChain

function depositOnSrcChain(
        address _vault,
        uint _amount,
        bytes32 _intentionId
    )

Deposit tokens to vault on the source chain. This is necessary if the bridge fails and the tokens remain in the StargateAdapter. Only callable by the vault or admin.

Params

Param
Type
Description

_vault

address

Address of the vault

_amount

uint

Amount of tokens to be sent

_intentionId

bytes32

Intention id

withdraw

function withdraw(address to, uint amount)

Withdraw native from the StargateAdapter. Only callable by the admin.

Params

Param
Type
Description

to

address

Address of the receiver

amount

uint

Amount of native to be withdrawn

sweep

function sweep(address to, address token, uint amount)

Withdraw any token from the StargateAdapter. Only callable by the admin.

Params

Param
Type
Description

to

address

Address of the receiver

token

address

Address of the token to be withdrawn

amount

uint

Amount of token to be withdrawn

setDstAdapter

function setDstAdapter(
        uint32 _dstEid,
        address _dstAdapterAddress
    )

Set the destination StargateAdapter address for a given destination chain. The StargateAdapter can only send tokens to the configured StargateAdapter on the other chain. Only callable by the admin.

Params

Param
Type
Description

_dstEid

uint32

LayerZero endpoint ID for the destination chains.

_dstAdapterAddress

address

Address of the destination StargateAdapter

setStargate

function setStargate(address _stargate)

Set the Stargate address. Only callable by the admin.

Params

Param
Type
Description

_stargate

address

Address of the Stargate

setLzExtraOptions

function setLzExtraOptions(
        uint32 _dstEid,
        uint _extraOptions
    )

Set the LayerZero extra options for a given destination chain. Only callable by the admin.

Params

Param
Type
Description

_dstEid

uint32

LayerZero endpoint ID for the destination chains.

_extraOptions

uint

Extra options for LayerZero

Read functions

isDstAdapterExists

function isDstAdapterExists(uint32 dstEid)

Check if the destination StargateAdapter exists for a given destination chain.

Params

Param
Type
Description

dstEid

uint32

LayerZero endpoint ID for the destination chains.

Returns

Type
Description

bool

True if the destination StargateAdapter exists, false otherwise

getDstAdapter

function getDstAdapter(uint32 dstEid)

Get the destination StargateAdapter address for a given destination chain.

Params

Param
Type
Description

dstEid

uint32

LayerZero endpoint ID for the destination chains.

Returns

Type
Description

address

Address of the destination StargateAdapter

getStargateByToken

function getStargateByToken(address token)

Get the Stargate address for a given token.

Params

Param
Type
Description

token

address

Address of the token

Returns

Type
Description

address

Address of the Stargate

PreviousMaatAddressProviderV1NextStrategy

Last updated 7 months ago