StargateAdapter
StargateAdapter
is a contract that vaults use to interact and bridge assets between chains through Stargate.
Write functions
sendTokens
MAAT vault call this function to send tokens to vault on other chain. Only callable by the vault or admin.
Params
_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
_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 to call by LayerZero.
depositOnSrcChain
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
_vault
address
Address of the vault
_amount
uint
Amount of tokens to be sent
_intentionId
bytes32
Intention id
withdraw
Withdraw native from the StargateAdapter. Only callable by the admin.
Params
to
address
Address of the receiver
amount
uint
Amount of native to be withdrawn
sweep
Withdraw any token from the StargateAdapter. Only callable by the admin.
Params
to
address
Address of the receiver
token
address
Address of the token to be withdrawn
amount
uint
Amount of token to be withdrawn
setDstAdapter
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
_dstEid
uint32
LayerZero endpoint ID for the destination chains.
_dstAdapterAddress
address
Address of the destination StargateAdapter
setStargate
Set the Stargate address. Only callable by the admin.
Params
_stargate
address
Address of the Stargate
setLzExtraOptions
Set the LayerZero extra options for a given destination chain. Only callable by the admin.
Params
_dstEid
uint32
LayerZero endpoint ID for the destination chains.
_extraOptions
uint
Extra options for LayerZero
Read functions
isDstAdapterExists
Check if the destination StargateAdapter exists for a given destination chain.
Params
dstEid
uint32
LayerZero endpoint ID for the destination chains.
Returns
bool
True if the destination StargateAdapter exists, false otherwise
getDstAdapter
Get the destination StargateAdapter address for a given destination chain.
Params
dstEid
uint32
LayerZero endpoint ID for the destination chains.
Returns
address
Address of the destination StargateAdapter
getStargateByToken
Get the Stargate address for a given token.
Params
token
address
Address of the token
Returns
address
Address of the Stargate
Last updated