0% found this document useful (0 votes)
80 views

Stargate API Docs

API documentation file for using Stargate Protocol.

Uploaded by

Jordan Durrani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Stargate API Docs

API documentation file for using Stargate Protocol.

Uploaded by

Jordan Durrani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Introduction

Welcome to Stargate V2 documentation!

You can find here necessary information and code examples required to build on top of Stargate.

New features

A quick summary of V1 → V2 upgrades goes as follows:

​ Cost Reduction: V2 drastically reduces the cost for users and developers compared to V1 through transaction batching (Stargate Bus) and a one-to-one
transaction mode (Taxi Mode).
​ More Chains: V2 introduces "Hydra," a novel expansion to offer Bridging as a Service. This feature allows for the seamless flow of assets across chains,
including those without native assets, by locking assets in core pools on source chains and minting corresponding assets on destination chains. This
mechanism ensures that assets are always redeemable and leverages Protocol Locked Liquidity for internal accounting. The assets used as wrapped assets
on destination are built on the OFT Standard.
​ Capital Efficiency: To address V1's limitations regarding dynamics and scalability, V2 introduces an off-chain mechanism called the AI Planning Module to
adapt more swiftly to volume changes and user preferences, moving beyond the constraints of on-chain-only operations.

Interfaces

Stargate V2 has been built on top of LayerZero V2, which means there is a lot of different functionality built into the protocol. It also opens up a lot of interesting surfaces
to build on. If you want to learn more about LayerZero omnichain messaging, please refer to its documentation.

It also means that the Stargate interfaces have changed.

Stargate V2 interfaces are the same as the IOFT interface for OFTs on LayerZero V2. IOFT interface is available here. Documentation for building on IOFT is here.

Token Types
Learn more about different types of pools in Stargate.
There are two types of Stargate token instances that can exist on particular chain. Only one instance will exist per chain. The token on a specific chain is either using a
Pool or it is a Hydra OFT. Both of them are OFTs (LayerZero's Omnichain Fungible Tokens) and derive from the StargateBase contract.

Pool
A pool is a regular Stargate liquidity pool where e.g. USDC will be deposited. Liquidity from these pools is later used to enable cross chain swaps of the same asset.

Deposit
Copy
function deposit(

address _receiver,

uint256 _amountLD

) external payable nonReentrantAndNotPaused returns (uint256 amountLD)

Withdraw
There are two ways you can withdraw your tokens from the liquidity pool. The first is a standard function which returns the pool's underlying token in exchange for the
liquidity token on the same chain the method is called:
Copy
function redeem(

uint256 _amountLD,

address _receiver

) external nonReentrantAndNotPaused returns (uint256 amountLD)

The second function also allows for redeeming the underlying token, but it also sends it to the destination chain that user wants. This function can only be used in taxi
mode. Here's a signature of the function:
Copy
function redeemSend(

SendParam calldata _sendParam,

MessagingFee calldata _fee,

address _refundAddress

) external payable nonReentrantAndNotPaused

returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt)

Credits

Redeeming liquidity tokens for underlying pool tokens, e.g., LP to USDC, may in some cases be limited by the credits available on the particular chain you want to
redeem on. For the redeem() function to successfully process, an adequate number of credits must be available on the local blockchain where the redeem transaction is
initiated. If you call redeemSend() enough credits need to be available on the destination chain. You can read more about Credits.
Composability

Because redeemSend() is using the LayerZero protocol to send the message to the destination chain - it is also composable. You can read more about Composability.

Code
The code for the ERC20 token pool lives in StargatePool.sol and is using StargatePoolNative.solfor the native token.

When you call stargateType() method from the IStargate interface on the Pool asset it will return:
Copy
StargateType.Pool

Hydra (OFTs)
Introduction
Hydra extends Stargate via Bridging as a Service (BaaS). With Hydra, Stargate enables users to transfer Hydra-wrapped versions of USDC, USDT, and ETH to Hydra
chains (and between Hydra chains) quickly.

How Hydra Works


Hydra operates on a foundational principle where Stargate's core pools, residing on chains with native assets (e.g., Ethereum, Arbitrum, Optimism), are leveraged to
facilitate asset bridging to newer chains lacking native assets.

The minting of Hydra assets on Chain X uses the Omnichain Fungible Tokens (OFT) Standard. This process is initiated when assets, such as USDC, are bridged from a
core chain (e.g., Arbitrum) to a Hydra-enabled chain (referred to as Chain X in this context). The bridged assets are securely locked within Stargate’s pool contracts on
the origin chain, while an equivalent asset is minted on Chain X. A basic outline of the Hydra process goes as follows:

​ When a user bridges USDC from Arbitrum to Chain X, their USDC assets get locked in the secure USDC pool on Arbitrum, and an asset minted on Chain X.
​ The user's USDC will always sit in an underlying Pool contract until they want to come back to Arbitrum (or any other Stargate core chain)

Since the asset minted on Chain X is an OFT, it can be horizontally composed across all current and future Hydra chains. The user could bridge from Chain X to Y, and
always come back through Stargate to Arbitrum (or any other core chain). In other words, underlying assets are always redeemable from any core Stargate chain.

Code
Hydra code lives in StargateOFT.sol.

When you call stargateType() method from theIStargate interface on a Hydra asset it will return:
Copy
StargateType.OFT

How to List Your Token on Stargate


This guide explains how to obtain Stargate support for bridging your token.

OFT
Stargate will list any OFT that requests a listing, as mandated by the DAO in this vote. As part of this vote, every transfer through Stargate will also be subject to a 2bps
(0.02%) fee.

Please fill out this form with all relevant information regarding your OFT.

It is required that the networks where the OFTs are deployed are fully interconnected (full-mesh). For example, if your OFT contracts are deployed on networks A, B, and
C, ensure the following pathways are active: A<>B ; B<>C ; A<>C .

Additionally, every pathway MUST have enforcedOptions set. You can read more about this in LayerZero's documentation.

Hydra (OFTs)
Hydra operates on a foundational principle where Stargate's core pools, residing on chains with native assets (e.g., Ethereum, Arbitrum, Optimism), are leveraged to
facilitate asset bridging to newer chains lacking native assets. The Hydra supported assets are OFTs. If you would like to enable the Hydra supports for your chain, you
should contact the Stargate Foundation to facilitate the deployment.

APD - Autonomous Pool Deployment


If your token is not using OFT standard, you can still have it listed on Stargate. To do this, start by submitting a proposal on Commonwealth by following the instructions
provided in this guide. Your proposal must undergo and pass the governance process, including receiving community approval through votes on Snapshot.

After approval, you are required to provide the specified liquidity for each pool as outlined in your proposal. Furthermore, if your proposal includes incentive programs,
you should implement these as well. Lastly, you will be responsible for managing the pools, specifically rebalancing them when liquidity in certain pathways runs low,
which could impact users' ability to bridge tokens.
Estimating Fees
Learn more about estimating fees associated with Stargate transfers.
Stargate offers five distinct methods to estimate transfer fees. Let's begin by exploring the most commonly utilized ones.

High level functions


The two highest level functions are:

​ quoteOFT

​ quoteSend

They are both part of IStargate interface.

quoteOFT

This method provides a quote for sending OFT to another chain. It can be used to calculate minimum amount of tokens you will receive on destination chain after you
swap.

This function also returns maximum number of tokens possible to bridge to a particular chain. It is very important taking into consideration the Credits mechanism in
Stargate.

This is how the interface of the function looks like:


Copy
/// @notice Provides a quote for sending OFT to another chain.

/// @dev Implements the IOFT interface

/// @param _sendParam The parameters for the send operation

/// @return limit The information on OFT transfer limits

/// @return oftFeeDetails The details of OFT transaction cost or reward

/// @return receipt The OFT receipt information, indicating how many tokens would be sent and received

function quoteOFT(

SendParam calldata _sendParam

) external view returns (

OFTLimit memory limit,

OFTFeeDetail[] memory oftFeeDetails,

OFTReceipt memory receipt

As you can see, the only input parameter is SendParam:


Copy
/**

* @dev Struct representing token parameters for the OFT send() operation.

*/

struct SendParam {

uint32 dstEid; // Destination endpoint ID.

bytes32 to; // Recipient address.

uint256 amountLD; // Amount to send in local decimals.

uint256 minAmountLD; // Minimum amount to send in local decimals.

bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message.

bytes composeMsg; // The composed message for the send() operation.

bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations.

It contains all the information required to send the transfer. If you want to learn more about preparing this struct please read How to Swap.

Now, let's analyze the output of quoteOFT():


OFTLimit limit - it returns minimum and maximum amounts of tokens in local decimals that can be transferred to the receiver. The maximum amount of tokens received
on the destination chain might be limited by the credits mechanism in Stargate.

​ Example value: OFTLimit({ minAmountLD: 1000000000000 [1e12], maxAmountLD: 18446744073709551615000000000000 [1.844e31] })


OFTFeeDetail[] oftFeeDetails - array of structs containing information about fees or rewards in local decimals with their descriptions. Note that feeAmountLD is int256 so
it can be positive or negative. If you would like to learn more read Treasury fees and rewards.

​ Example value: [OFTFeeDetail({ feeAmountLD: 1000000000000 [1e12], description: "reward" })]

​ OFTReceipt receipt:

Copy
struct OFTReceipt {

uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals.

// @dev In non-default implementations, the amountReceivedLD COULD differ from this value.

uint256 amountReceivedLD; // Amount of tokens to be received on the remote side.

Example value: OFTReceipt({ amountSentLD: 100000000000000 [1e14], amountReceivedLD: 100000000000000 [1.01e14] })

amountReceivedLD from quoteOFT() can be used to override SendParam.minAmountLD that is later passed to quoteSend(). minAmountLD is minimum amount of tokens to
send. If due to applied fees/reward the actual amount sent would drop below this value then the fee library will revert with SlippageTooHigh.

quoteSend

This method provides a way to calculate total fee for a given send() operation. It reverts with InvalidAmount if send mode is drive but value is specified.

This is an interface of the function:


Copy
function quoteSend(

SendParam calldata _sendParam,

bool _payInLzToken

) external view returns (MessagingFee memory fee)

It accepts SendParam and a boolean whether to pay in LayerZero token. For more information on how to prepare the SendParam please read How to Swap.

quoteSend returns MessagingFee struct:


Copy
struct MessagingFee {

uint256 nativeFee;

uint256 lzTokenFee;

Lower level functions


Below you can see some of the lower level functions which might be useful for advanced use cases. In a typical use case, when you call quoteSend these lower level
functions are called automatically and there's no need to call them directly.

quoteTaxi

This function is part of ITokenMessaging interface:


Copy
function quoteTaxi(

TaxiParams calldata _params,

bool _payInLzToken

) external view returns (MessagingFee memory fee);

This function accepts TaxiParams and a boolean indicating whether to pay in LayerZero token as input parameters. It returns a quote for how much needs to be paid for
the transfer.

Let's focus on the TaxiParams here:


Copy
struct TaxiParams {

address sender;

uint32 dstEid;

bytes32 receiver;

uint64 amountSD;

bytes composeMsg;

bytes extraOptions;

}
This is what you need to provide to the above function. You can also programatically convert SendParam to TaxiParams by calling:
Copy
using MessagingHelper for SendParam;

// ...

function _ld2sd(uint256 _amountLD) internal view returns (uint64 amountSD) {

unchecked {

amountSD = SafeCast.toUint64(_amountLD / convertRate);

// ...

uint64 amountSD = _ld2sd(sendParam.amountLD);

sendParam.toTaxiParams(amountSD)

quoteRideBus

This function is part of theITokenMessaging interface:


Copy
function quoteRideBus(

uint32 _dstEid, bool _nativeDrop

) external view returns (MessagingFee memory fee);

It returns a total fee for the bus ride transfer and accepts Destination Endpoint Id (_dstEid) and a boolean that represents whether to pay for a native drop on the
destination.

Treasury fees and rewards


There are two types of Stargate token instances that can exist on particular chain. Only one instance will exist per asset per chain. A token on specific chain is either
using a Pool or it is a Hydra OFT.

When sending tokens from Pool it can either charge a treasury fee or reward you for the transfer.

If you transfer from Hydra OFT there is no reward, but the treasury fee can be charged.

As a reminder you can query treasury fees or rewards using quoteOFT(). Fees within the Stargate protocol are dynamic, and are set by the AI Planning Module on a per
pathway basis.

Reward

The reward is capped by the treasury fee pool. The function addTreasuryFee() can be called by the treasurer, which will emit the following event:
Copy
event TreasuryFeeAdded(uint64 amountSD);

Estimating Fees
Learn more about estimating fees associated with Stargate transfers.
Stargate offers five distinct methods to estimate transfer fees. Let's begin by exploring the most commonly utilized ones.

High level functions


The two highest level functions are:

​ quoteOFT

​ quoteSend

They are both part of IStargate interface.

quoteOFT

This method provides a quote for sending OFT to another chain. It can be used to calculate minimum amount of tokens you will receive on destination chain after you
swap.
This function also returns maximum number of tokens possible to bridge to a particular chain. It is very important taking into consideration the Credits mechanism in
Stargate.

This is how the interface of the function looks like:


Copy
/// @notice Provides a quote for sending OFT to another chain.

/// @dev Implements the IOFT interface

/// @param _sendParam The parameters for the send operation

/// @return limit The information on OFT transfer limits

/// @return oftFeeDetails The details of OFT transaction cost or reward

/// @return receipt The OFT receipt information, indicating how many tokens would be sent and received

function quoteOFT(

SendParam calldata _sendParam

) external view returns (

OFTLimit memory limit,

OFTFeeDetail[] memory oftFeeDetails,

OFTReceipt memory receipt

As you can see, the only input parameter is SendParam:


Copy
/**

* @dev Struct representing token parameters for the OFT send() operation.

*/

struct SendParam {

uint32 dstEid; // Destination endpoint ID.

bytes32 to; // Recipient address.

uint256 amountLD; // Amount to send in local decimals.

uint256 minAmountLD; // Minimum amount to send in local decimals.

bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message.

bytes composeMsg; // The composed message for the send() operation.

bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations.

It contains all the information required to send the transfer. If you want to learn more about preparing this struct please read How to Swap.

Now, let's analyze the output of quoteOFT():


OFTLimit limit - it returns minimum and maximum amounts of tokens in local decimals that can be transferred to the receiver. The maximum amount of tokens received
on the destination chain might be limited by the credits mechanism in Stargate.

​ Example value: OFTLimit({ minAmountLD: 1000000000000 [1e12], maxAmountLD: 18446744073709551615000000000000 [1.844e31] })

OFTFeeDetail[] oftFeeDetails - array of structs containing information about fees or rewards in local decimals with their descriptions. Note that feeAmountLD is int256 so
it can be positive or negative. If you would like to learn more read Treasury fees and rewards.

​ Example value: [OFTFeeDetail({ feeAmountLD: 1000000000000 [1e12], description: "reward" })]

​ OFTReceipt receipt:

Copy
struct OFTReceipt {

uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals.

// @dev In non-default implementations, the amountReceivedLD COULD differ from this value.

uint256 amountReceivedLD; // Amount of tokens to be received on the remote side.

Example value: OFTReceipt({ amountSentLD: 100000000000000 [1e14], amountReceivedLD: 100000000000000 [1.01e14] })

amountReceivedLD from quoteOFT() can be used to override SendParam.minAmountLD that is later passed to quoteSend(). minAmountLD is minimum amount of tokens to
send. If due to applied fees/reward the actual amount sent would drop below this value then the fee library will revert with SlippageTooHigh.
quoteSend

This method provides a way to calculate total fee for a given send() operation. It reverts with InvalidAmount if send mode is drive but value is specified.

This is an interface of the function:


Copy
function quoteSend(

SendParam calldata _sendParam,

bool _payInLzToken

) external view returns (MessagingFee memory fee)

It accepts SendParam and a boolean whether to pay in LayerZero token. For more information on how to prepare the SendParam please read How to Swap.

quoteSend returns MessagingFee struct:


Copy
struct MessagingFee {

uint256 nativeFee;

uint256 lzTokenFee;

Lower level functions


Below you can see some of the lower level functions which might be useful for advanced use cases. In a typical use case, when you call quoteSend these lower level
functions are called automatically and there's no need to call them directly.

quoteTaxi

This function is part of ITokenMessaging interface:


Copy
function quoteTaxi(

TaxiParams calldata _params,

bool _payInLzToken

) external view returns (MessagingFee memory fee);

This function accepts TaxiParams and a boolean indicating whether to pay in LayerZero token as input parameters. It returns a quote for how much needs to be paid for
the transfer.

Let's focus on the TaxiParams here:


Copy
struct TaxiParams {

address sender;

uint32 dstEid;

bytes32 receiver;

uint64 amountSD;

bytes composeMsg;

bytes extraOptions;

This is what you need to provide to the above function. You can also programatically convert SendParam to TaxiParams by calling:
Copy
using MessagingHelper for SendParam;

// ...

function _ld2sd(uint256 _amountLD) internal view returns (uint64 amountSD) {

unchecked {

amountSD = SafeCast.toUint64(_amountLD / convertRate);

// ...
uint64 amountSD = _ld2sd(sendParam.amountLD);

sendParam.toTaxiParams(amountSD)

quoteRideBus

This function is part of theITokenMessaging interface:


Copy
function quoteRideBus(

uint32 _dstEid, bool _nativeDrop

) external view returns (MessagingFee memory fee);

It returns a total fee for the bus ride transfer and accepts Destination Endpoint Id (_dstEid) and a boolean that represents whether to pay for a native drop on the
destination.

Treasury fees and rewards


There are two types of Stargate token instances that can exist on particular chain. Only one instance will exist per asset per chain. A token on specific chain is either
using a Pool or it is a Hydra OFT.

When sending tokens from Pool it can either charge a treasury fee or reward you for the transfer.

If you transfer from Hydra OFT there is no reward, but the treasury fee can be charged.

As a reminder you can query treasury fees or rewards using quoteOFT(). Fees within the Stargate protocol are dynamic, and are set by the AI Planning Module on a per
pathway basis.

Reward

The reward is capped by the treasury fee pool. The function addTreasuryFee() can be called by the treasurer, which will emit the following event:
Copy
event TreasuryFeeAdded(uint64 amountSD);

Modes of Transport: Taxi and Bus


There are two modes of transport for sending Stargate transactions. The first is taxi, where tokens are sent to the destination chain at the moment of swap. The second
is bus ride. Bus ride means that multiple user swaps are batched together. Tokens are sent to the destination chain when the bus is driven.

Driving the Bus: This will either happen automatically via the planner when the bus is full, or during the regularly scheduled bus service, commissioned by the Stargate
Foundation, while parameters are perfected.

Composability
Stargate is a fully composable liquidity transport protocol meaning it supports additional compose logic on destination chain. You can use this feature to perform calls to
external smart contracts.
Note: Only Stargate's taxi() method is composable, you cannot perform destination logic with rideBus().

Composable methods
The following methods are composable:

​ IStargate.sendToken()

​ IStargate.send()

​ IStargatePool.redeemSend()

Architecture
Send

To take advantage of compose feature you need to modify SendParam struct passed to IStargate.sendToken().

First, you need to change:


Copy
bytes calldata composeMsg

Make sure it is non-zero bytes. You would usually use this field with ABI encode and decode to pass your application-specific input that contracts along the way
understand.

You also need to pass additional gas for the compose call. You need to set this value to the amount of gas your lzCompose function in the compose receiver consumes.

For "taxi" you can use typical LayerZero's OptionsBuilder. Make sure to pass it as SendParam.extraOptions:
Copy
bytes memory extraOptions = _composeMsg.length > 0
? OptionsBuilder.newOptions().addExecutorLzComposeOption(0, 200_000, 0) // compose gas limit

: bytes("");

Receive

Stargate will attempt to call LayerZero's Endpoint.sendCompose() on the destination chain when it distributes tokens to receiver.

Here's how the Stargate internal call looks like:


Copy
endpoint.sendCompose(_payload.receiver, _guid, _payload.composeIdx, composeMsg);

where composeMsg is:


Copy
composeMsg = OFTComposeMsgCodec.encode(_origin.nonce, _origin.srcEid, amountLD, _payload.composeMsg);

and receiver is an address that was supposed to receive tokens on the destination chain.

Stargate is using standard OFTComposeMsgCodec for encoding a composed message. This means that when you receive this message in the composer it will be
encoded using the aforementioned codec.

To access your custom application specific message (the one you passed as SendParams.composeMsg) you have to call:
Copy
bytes memory _composeMessage = OFTComposeMsgCodec.composeMsg(_message);

Implementing "composer receiver"

To receive a composed message from Stargate and perform additional logic the receiver address has to be a smart contract implementing ILayerZeroComposer.
LayerZero's Endpoint defaults to calling the lzCompose() function on the receiver contract address.

Here's how an example receiver can look like:


Copy
pragma solidity ^0.8.19;

import { ILayerZeroComposer } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroComposer.sol";

contract ComposerReceiver is ILayerZeroComposer {

event ComposeAcknowledged(address indexed _from, bytes32 indexed _guid, bytes _message, address _executor, bytes _extraData);

uint256 public acknowledgedCount;

function lzCompose(

address _from,

bytes32 _guid,

bytes calldata _message,

address _executor,

bytes calldata _extraData

) external payable {

acknowledgedCount++;

emit ComposeAcknowledged(_from, _guid, _message, _executor, _extraData);

fallback() external payable {}

receive() external payable {}

This very simple example above will emit ComposeAcknowledged each time a composed call is received and increment the acknowledgedCount by 1. A more advanced
contract example is detailed below.

External contract interaction example


Below you can find a Solidity example of doing a swap through external smart contract with a composed message, using the taxi method.
This example illustrates the process of swapping Token A on the source chain for Token B on the destination chain. Following this, it demonstrates how to swap Token B
for Token C on the destination chain by leveraging an external smart contract through a composed call.

Send

Preparing arguments:
Copy
pragma solidity ^0.8.19;

import { IStargate, Ticket } from "@stargatefinance/stg-evm-v2/src/interfaces/IStargate.sol";

import { MessagingFee, OFTReceipt, SendParam } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/interfaces/IOFT.sol";

import { OptionsBuilder } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/libs/OptionsBuilder.sol";

contract StargateIntegrationWithCompose {

using OptionsBuilder for bytes;

function prepareTakeTaxiAndAMMSwap(

address _stargate,

uint32 _dstEid,

uint256 _amount,

address _composer,

bytes memory _composeMsg

) external view returns (uint256 valueToSend, SendParam memory sendParam, MessagingFee memory messagingFee) {

bytes memory extraOptions = _composeMsg.length > 0

? OptionsBuilder.newOptions().addExecutorLzComposeOption(0, 200_000, 0) // compose gas limit

: bytes("");

sendParam = SendParam({

dstEid: _dstEid,

to: addressToBytes32(_composer),

amountLD: _amount,

minAmountLD: _amount,

extraOptions: extraOptions,

composeMsg: _composeMsg,

oftCmd: ""

});

IStargate stargate = IStargate(_stargate);

(, , OFTReceipt memory receipt) = stargate.quoteOFT(sendParam);

sendParam.minAmountLD = receipt.amountReceivedLD;

messagingFee = stargate.quoteSend(sendParam, false);

valueToSend = messagingFee.nativeFee;

if (stargate.token() == address(0x0)) {

valueToSend += sendParam.amountLD;

}
function addressToBytes32(address _addr) internal pure returns (bytes32) {

return bytes32(uint256(uint160(_addr)));

Sending transaction:
Copy
bytes memory _composeMsg = abi.encode(_tokenReceiver, _oftOnDestination, _tokenOut, _amountOutMinDest, _deadline);

(uint256 valueToSend, SendParam memory sendParam, MessagingFee memory messagingFee) =

integration.prepareTakeTaxiAndAMMSwap(stargate, destinationEndpointId, amount, address(composer), _composeMsg);

IStargate stargate = IStargate(stargate);

IStargate(stargate).sendToken{ value: valueToSend }(sendParam, messagingFee, refundAddress);

Receive

On the receive side we will use dummy IMockAMM interface to demonstrate how the external call to the swap function can look like:
Copy
pragma solidity ^0.8.19;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { ILayerZeroComposer } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroComposer.sol";

import { OFTComposeMsgCodec } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/libs/OFTComposeMsgCodec.sol";

import { IMockAMM } from './interfaces/IMockAMM.sol';

contract ComposerReceiverAMM is ILayerZeroComposer {

IMockAMM public immutable amm;

address public immutable endpoint;

address public immutable stargate;

event ReceivedOnDestination(address token);

constructor(address _amm, address _endpoint, address _stargate) {

amm = IMockAMM(_amm);

endpoint = _endpoint;

stargate = _stargate;

function lzCompose(

address _from,

bytes32 _guid,

bytes calldata _message,

address _executor,

bytes calldata _extraData

) external payable {

require(_from == stargate, "!stargate");

require(msg.sender == endpoint, "!endpoint");

uint256 amountLD = OFTComposeMsgCodec.amountLD(_message);


bytes memory _composeMessage = OFTComposeMsgCodec.composeMsg(_message);

(address _tokenReceiver, address _oftOnDestination, address _tokenOut, uint _amountOutMinDest, uint _deadline) =

abi.decode(_composeMessage, (address, address, address, uint, uint));

address[] memory path = new address[](2);

path[0] = _oftOnDestination;

path[1] = _tokenOut;

IERC20(_oftOnDestination).approve(address(amm), amountLD);

try amm.swapExactTokensForTokens(

amountLD,

_amountOutMinDest,

path,

_tokenReceiver,

_deadline

){

emit ReceivedOnDestination(_tokenOut);

} catch {

IERC20(_oftOnDestination).transfer(_tokenReceiver, amountLD);

emit ReceivedOnDestination(_oftOnDestination);

fallback() external payable {}

receive() external payable {}

As shown above, lzCompose() will attempt to swap token B received from Stargate into token C and transfer it to the receiver address. If the swap fails in the try/catch
clause it will send the original token B to the receiver address instead.

Credit Allocation System


Introduction
Credits are a way of tracking inflows and outflows of tokens in the protocol.

Instant Guaranteed Finality


Thanks to the credit allocation mechanism, Stargate maintains a crucial property of cross-chain systems, which is Instant Guaranteed Finality.

Instant Guaranteed Finality means that Stargate swaps are settled locally immediately, without the risk of revert, rollback or double spending on the source chain. You
still need to wait for the tokens to be delivered on the destination chain by the underlying messaging protocol, but Stargate ensures the success of the destination
transaction.

It is possible because Stargate was designed to hold following invariant true:


For each pool:
pool balance >=

​ local unallocated credits + sum of allocated credits in remote paths


​ Sum of pool balances >= sum of OFT supplies + sum of total values locked

AI Planning Module
Credits in Stargate V2 are handled by the AI Planning Module (Planner in codebase), which conducts automated credit rebalancing within the protocol. It’s role is simply
to ensure credits are allocated and reallocated to pathways that see the most volume. Stargate V1 had static credits on pathways. Stargate V2 has dynamic credits and
therefore much greater capital efficiency.

Code related to rebalancing credits can be found in CreditMessaging contract.

Pathway credit operations


In rare cases you may run into some issues with the credits mechanism. For example when there's not enough credits PathLib might revert with
Path_InsufficientCredit. In this section you can find high-level overview of credit operations in Stargate to assist you in debugging.

StargateBase contract
In the PathLib library there are methods to increase and decrease credits for paths to different endpoints. These functions are called both by Pool and Hydra tokens. In
StargateBase contract there's a function _inflowAndCharge() triggered when value is transferred from an account into Stargate to execute a swap as part of sendToken()
call.

The system reduces the credits for the destination pathway where the user is transferring tokens:
Copy
paths[_sendParam.dstEid].decreaseCredit(amountOutSD); // remove the credit from the path

There are also two methods that can be indirectly called by the Planner: sendCredits() and receiveCredits() to increase or decrease credit balances for different paths.

StargatePool contract

The StargatePool contract also performs operations on credits as part of its lifecycle.

It increases/decreases local credits based on fee or rewards in redeemSend() when redeeming tokens on destination endpoint:
Copy
if (amountInSD > amountOutSD) {

// fee

uint64 fee = amountInSD - amountOutSD;

paths[localEid].decreaseCredit(fee);

poolBalanceSD -= fee;

} else if (amountInSD < amountOutSD) {

// reward

uint64 reward = amountOutSD - amountInSD;

paths[localEid].increaseCredit(reward);

poolBalanceSD += reward;

When redeem() is called instead and tokens are redeemed locally it subtracts redeemed amount from local credits:
Copy
amountSD = paths[localEid].tryDecreaseCredit(amountSD);

Mainnet Contracts
Ethereum
endpointID: 30101

Contract Address

FeeLibV1ETH.sol 0x3E368B6C95c6fEfB7A16dCc0D756389F3c658a06

FeeLibV1USDC.sol 0x52B35406CB2FB5e0038EdEcFc129A152a1f74087

FeeLibV1USDT.sol 0xe171AFcd1E0394b3312e68ca823D5BC87F3Db311

FeeLibV1METIS.sol 0x6Dd69717B1194B81A92105B7e0F94cb40f68A3e3

FeeLibV1mETH.sol 0x6D5521F46b2cba9443feFC09cBaC3B15AE0F73eB
StargateMultiRewarder.sol 0x5871A7f88b0f3F5143Bf599Fd45F8C0Dc237E881

StargatePoolNative.sol 0x77b2043768d28E9C9aB44E1aBfC95944bcE57931

StargatePoolUSDC.sol 0xc026395860Db2d07ee33e05fE50ed7bD583189C7

StargatePoolUSDT.sol 0x933597a323Eb81cAe705C5bC29985172fd5A3973

StargatePoolMETIS.sol 0xcDafB1b2dB43f366E48e6F614b8DCCBFeeFEEcD3

StargatePoolmETH.sol 0x268Ca24DAefF1FaC2ed883c598200CcbB79E931D

StargateStaking.sol 0xFF551fEDdbeDC0AeE764139cCD9Cb644Bb04A6BD

TokenMessaging.sol 0x6d6620eFa72948C5f68A3C8646d58C00d3f4A980

Treasurer.sol 0x1041D127b2d4BC700F0F563883bC689502606918

BNB Chain
endpointID: 30102

Contract Address

FeeLibV1USDT.sol 0xDd002227d9bC27f10066ED9A17bE89c43bCafC31

StargateMultiRewarder.sol 0x68D7877b16002AD34836ba55416bcA9B92B55589

StargatePoolUSDT.sol 0x138EB30f73BC423c6455C53df6D89CB01d9eBc63

StargateStaking.sol 0x26727C78B0209d9E787b2f9ac8f0238B122a3098

TokenMessaging.sol 0x6E3d884C96d640526F273C61dfcF08915eBd7e2B

Treasurer.sol 0x0a6A15964fEe494A881338D65940430797F0d97C

Avalanche
endpointID: 30106

Contract Address

FeeLibV1USDC.sol 0xDFc47DCeF7e8f9Ab19a1b8Af3eeCF000C7ea0B80

FeeLibV1USDT.sol 0x22BdF9633F3e679785638Db690b85dC0Dc8B35B8
StargateMultiRewarder.sol 0x6CE9bf8CDaB780416AD1fd87b318A077D2f50EaC

StargatePoolUSDC.sol 0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47

StargatePoolUSDT.sol 0x12dC9256Acc9895B076f6638D628382881e62CeE

StargateStaking.sol 0x8db623d439C8c4DFA1Ca94E4CD3eB8B3Aaff8331

TokenMessaging.sol 0x17E450Be3Ba9557F2378E20d64AD417E59Ef9A34

Treasurer.sol 0xC2b638Cb5042c1B3c5d5C969361fB50569840583

Polygon
endpointID: 30109

Contract Address

FeeLibV1USDC.sol 0x3Fc69CC4A842838bCDC9499178740226062b14E4

FeeLibV1USDT.sol 0x4e422B0aCb2Bd7e3aC70B5c0E5eb806e86a94038

StargateMultiRewarder.sol 0xd240a859Efc77b7455AD1B1402357784a2D72a1B

StargatePoolUSDC.sol 0x9Aa02D4Fae7F58b8E8f34c66E756cC734DAc7fe4

StargatePoolUSDT.sol 0xd47b03ee6d86Cf251ee7860FB2ACf9f91B9fD4d7

StargateStaking.sol 0x4694900bDbA99Edf07A2E46C4093f88F9106a90D

TokenMessaging.sol 0x6CE9bf8CDaB780416AD1fd87b318A077D2f50EaC

Treasurer.sol 0x36ed193dc7160D3858EC250e69D12B03Ca087D08

Arbitrum
endpointID: 30110

Contract Address

FeeLibV1ETH.sol 0xda82A31dF339BfDF0123661134b4DB63Cb1706f5

FeeLibV1USDC.sol 0x80F755e3091b2Ad99c08Da8D13E9C7635C1b8161

FeeLibV1USDT.sol 0x1F605162282570dFa6255D27895587f4117F52FA
StargateMultiRewarder.sol 0x957b12606690C7692eF92bb5c34a0E63baED99C7

StargatePoolNative.sol 0xA45B5130f36CDcA45667738e2a258AB09f4A5f7F

StargatePoolUSDC.sol 0xe8CDF27AcD73a434D661C84887215F7598e7d0d3

StargatePoolUSDT.sol 0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0

StargateStaking.sol 0x3da4f8E456AC648c489c286B99Ca37B666be7C4C

TokenMessaging.sol 0x19cFCE47eD54a88614648DC3f19A5980097007dD

Treasurer.sol 0x146c8e409C113ED87C6183f4d25c50251DFfbb3a

Optimism
endpointID: 30111

Contract Address

FeeLibV1ETH.sol 0x80F755e3091b2Ad99c08Da8D13E9C7635C1b8161

FeeLibV1USDC.sol 0x1F605162282570dFa6255D27895587f4117F52FA

FeeLibV1USDT.sol 0x3da4f8E456AC648c489c286B99Ca37B666be7C4C

StargateMultiRewarder.sol 0x146c8e409C113ED87C6183f4d25c50251DFfbb3a

StargatePoolNative.sol 0xe8CDF27AcD73a434D661C84887215F7598e7d0d3

StargatePoolUSDC.sol 0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0

StargatePoolUSDT.sol 0x19cFCE47eD54a88614648DC3f19A5980097007dD

StargateStaking.sol 0xFBb5A71025BEf1A8166C9BCb904a120AA17d6443

TokenMessaging.sol 0xF1fCb4CBd57B67d683972A59B6a7b1e2E8Bf27E6

Treasurer.sol 0x644abb1e17291b4403966119d15Ab081e4a487e9

Metis
endpointID: 30151

Contract Address
FeeLibV1Metis.sol 0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0

FeeLibV1ETH.sol 0xe8CDF27AcD73a434D661C84887215F7598e7d0d3

FeeLibV1USDT.sol 0x19cFCE47eD54a88614648DC3f19A5980097007dD

StargateMultiRewarder.sol 0x1F605162282570dFa6255D27895587f4117F52FA

StargatePoolMetis.sol 0xD9050e7043102a0391F81462a3916326F86331F0

StargatePoolETH.sol 0x36ed193dc7160D3858EC250e69D12B03Ca087D08

StargatePoolUSDT.sol 0x4dCBFC0249e8d5032F89D6461218a9D2eFff5125

StargateStaking.sol 0xF1fCb4CBd57B67d683972A59B6a7b1e2E8Bf27E6

TokenMessaging.sol 0xcbE78230CcA58b9EF4c3c5D1bC0D7E4b3206588a

Treasurer.sol 0x3da4f8E456AC648c489c286B99Ca37B666be7C4C

Linea
endpointID: 30183

Contract Address

FeeLibV1ETH.sol 0x6E3d884C96d640526F273C61dfcF08915eBd7e2B

StargateMultiRewarder.sol 0xE89Ca5C58E2978c031f7796Ca8580bC88Ea0B3dD

StargatePoolNative.sol 0x81F6138153d473E8c5EcebD3DC8Cd4903506B075

StargateStaking.sol 0x25BBf59ef9246Dc65bFac8385D55C5e524A7B9eA

TokenMessaging.sol 0x5f688F563Dc16590e570f97b542FA87931AF2feD

Treasurer.sol 0xf5F74d2508e97A3a7CCA2ccb75c8325D66b46152

Mantle
endpointID: 30181

Contract Address

FeeLibV1WETH.sol 0x2BC3141AaeA1d84bcd557EeB543253fd9685c0C4
FeeLibV1USDC.sol 0x288968ffF40543F168eAf29A54D5C0affD3C8df7

FeeLibV1USDT.sol 0xa81274AFac523D639DbcA2C32c1470f1600cCEBe

FeeLibV1mETH.sol 0x6eC3EfD27d8b1070Fe96910EF416D54e845045c9

StargateMultiRewarder.sol 0x0184857631ddb3e9E230Bca303F0Ab1e516FC0c8

StargatePoolETH.sol 0x4c1d3Fc3fC3c177c3b633427c2F769276c547463

StargatePoolUSDC.sol 0xAc290Ad4e0c891FDc295ca4F0a6214cf6dC6acDC

StargatePoolUSDT.sol 0xa81274AFac523D639DbcA2C32c1470f1600cCEBe

StargatePoolmETH.sol 0xF7628d84a2BbD9bb9c8E686AC95BB5d55169F3F1

StargateStaking.sol 0x02DC1042E623A8677B002981164ccc05d25d486a

TokenMessaging.sol 0x41B491285A4f888F9f636cEc8a363AB9770a0AEF

Treasurer.sol 0x4e8c9BaC25CEF251352aCe831270D564615b9Ce1

Base
endpointID: 30184

Contract Address

FeeLibV1ETH.sol 0x17E450Be3Ba9557F2378E20d64AD417E59Ef9A34

FeeLibV1USDC.sol 0x08ed1d79D509A6f1020685535028ae60C144441E

StargateMultiRewarder.sol 0x9Aa02D4Fae7F58b8E8f34c66E756cC734DAc7fe4

StargatePoolNative.sol 0xdc181Bd607330aeeBEF6ea62e03e5e1Fb4B6F7C7

StargatePoolUSDC.sol 0x27a16dc786820B16E5c9028b75B99F6f604b5d26

StargateStaking.sol 0xDFc47DCeF7e8f9Ab19a1b8Af3eeCF000C7ea0B80

TokenMessaging.sol 0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47

Treasurer.sol 0xd47b03ee6d86Cf251ee7860FB2ACf9f91B9fD4d7
Kava
endpointID: 30177

Contract Address

FeeLibV1USDT.sol 0xA76CD3a43751090c40a35C37B38aA06973Cc6184

StargateMultiRewarder.sol 0x62207a4d054376052Bfcede2c00d113E97D4D247

StargatePoolUSDT.sol 0x41A5b0470D96656Fb3e8f68A218b39AdBca3420b

StargateStaking.sol 0x10e28bA4D7fc9cf39F34E20bbC5C58694b2f1A92

TokenMessaging.sol 0x6B73D3cBbb278Ce2E8698E983AecCdD94Dc4594B

Treasurer.sol 0xb7A05A3a687ef09cc70E3F98b5f6a62f32E3AE58

Scroll
endpointID: 30214

Contract Address

FeeLibV1ETH.sol 0x2A6c43e0DBDCde23d40c82F45682BC6D8A6dB219

FeeLibV1USDC.sol 0x503C5cFEa3477E0A576C8Cf5354023854b7A06Ff

StargateMultiRewarder.sol 0x4dCBFC0249e8d5032F89D6461218a9D2eFff5125

StargatePoolNative.sol 0xC2b638Cb5042c1B3c5d5C969361fB50569840583

StargatePoolUSDC.sol 0x3Fc69CC4A842838bCDC9499178740226062b14E4

StargateStaking.sol 0xd240a859Efc77b7455AD1B1402357784a2D72a1B

TokenMessaging.sol 0x4e422B0aCb2Bd7e3aC70B5c0E5eb806e86a94038

Treasurer.sol 0xcbE78230CcA58b9EF4c3c5D1bC0D7E4b3206588a

Aurora
endpointID: 30211

Contract Address

FeeLibV1USDC.sol 0x6E3d884C96d640526F273C61dfcF08915eBd7e2B

StargateMultiRewarder.sol 0xE89Ca5C58E2978c031f7796Ca8580bC88Ea0B3dD
StargatePoolUSDC.sol 0x81F6138153d473E8c5EcebD3DC8Cd4903506B075

StargateStaking.sol 0x25BBf59ef9246Dc65bFac8385D55C5e524A7B9eA

TokenMessaging.sol 0x5f688F563Dc16590e570f97b542FA87931AF2feD

Treasurer.sol 0xf5F74d2508e97A3a7CCA2ccb75c8325D66b46152

Klaytn
endpointID: 30150

Contract Address

FeeLibV1ETH.sol 0xB83ab1FF56cCD2B9E9914c68C182135C3a7ECFcd

FeeLibV1USDC.sol 0x8d92105ae654f494CE10B3b3e4C58186E3e0dA00

FeeLibV1USDT.sol 0x6eFfA1afE190a652a8204D318fec03D3dD9402d2

OFTTokenETH.sol 0x55Acee547DF909CF844e32DD66eE55a6F81dC71b

StargateOFTETH.sol 0xBB4957E44401a31ED81Cab33539d9e8993FA13Ce

StargateOFTUSDC.sol 0x01A7c805cc47AbDB254CD8AaD29dE5e447F59224

StargateOFTUSDT.sol 0x8619bA1B324e099CB2227060c4BC5bDEe14456c6

TokenMessaging.sol 0x16F3F98D82d965988E6853681fD578F4d719A1c0

Treasurer.sol 0x259EF40ebe42073bd70966519B53791f03a9212f

Iota
endpointID: 30284

Contract Address

FeeLibV1ETH.sol 0x0dB9afb4C33be43a0a0e396Fd1383B4ea97aB10a

FeeLibV1USDC.sol 0xCd4302D950e7e6606b6910Cd232758b5ad423311

FeeLibV1USDT.sol 0x711b5aAFd4d0A5b7B863Ca434A2678D086830d8E

OFTTokenETH.sol 0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8
StargateOFTETH.sol 0x9c2dc7377717603eB92b2655c5f2E7997a4945BD

StargateOFTUSDC.sol 0x8e8539e4CcD69123c623a106773F2b0cbbc58746

StargateOFTUSDT.sol 0x77C71633C34C3784ede189d74223122422492a0f

TokenMessaging.sol 0x1C10CC06DC6D35970d1D53B2A23c76ef370d4135

Treasurer.sol 0x8c1014B5936dD88BAA5F4DB0423C3003615E03a0

Taiko
endpointID: 30290

Contract Address

FeeLibV1USDC.sol 0xCd4302D950e7e6606b6910Cd232758b5ad423311

FeeLibV1USDT.sol 0x711b5aAFd4d0A5b7B863Ca434A2678D086830d8E

StargateOFTUSDC.sol 0x77C71633C34C3784ede189d74223122422492a0f

StargateOFTUSDT.sol 0x1C10CC06DC6D35970d1D53B2A23c76ef370d4135

TokenMessaging.sol 0x45d417612e177672958dC0537C45a8f8d754Ac2E

Treasurer.sol 0x8c1014B5936dD88BAA5F4DB0423C3003615E03a0

Rari Chain
endpointID: 30235

Contract Address

FeeLibV1USDC.sol 0x9c2dc7377717603eB92b2655c5f2E7997a4945BD

FeeLibV1USDT.sol 0x8e8539e4CcD69123c623a106773F2b0cbbc58746

StargateOFTUSDC.sol 0x875bee36739e7Ce6b60E056451c556a88c59b086

StargateOFTUSDT.sol 0x17d65bF79E77B6Ab21d8a0afed3bC8657d8Ee0B2

TokenMessaging.sol 0xC1B8045A6ef2934Cf0f78B0dbD489969Fa9Be7E4

Treasurer.sol 0x77C71633C34C3784ede189d74223122422492a0f
Sei
endpointID: 30280

Contract Address

FeeLibV1ETH.sol 0xDe48600aA18Ae707f5D57e0FaafEC7C118ABaeb2

OFTTokenETH.sol 0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8

StargateOFTETH.sol 0x5c386D85b1B82FD9Db681b9176C8a4248bb6345B

TokenMessaging.sol 0x1502FA4be69d526124D453619276FacCab275d3D

Treasurer.sol 0x873cfB4bAe1Ab6A5DE753400e9d0616e10Dced22

Flare
endpointID: 30295

Contract Address

FeeLibV1ETH.sol 0xCd4302D950e7e6606b6910Cd232758b5ad423311

FeeLibV1USDC.sol 0x711b5aAFd4d0A5b7B863Ca434A2678D086830d8E

FeeLibV1USDT.sol 0x8c1014B5936dD88BAA5F4DB0423C3003615E03a0

OFTTokenETH.sol 0x1502FA4be69d526124D453619276FacCab275d3D

StargateOFTETH.sol 0x8e8539e4CcD69123c623a106773F2b0cbbc58746

StargateOFTUSDC.sol 0x77C71633C34C3784ede189d74223122422492a0f

StargateOFTUSDT.sol 0x1C10CC06DC6D35970d1D53B2A23c76ef370d4135

TokenMessaging.sol 0x45d417612e177672958dC0537C45a8f8d754Ac2E

Treasurer.sol 0x090194F1EEDc134A680e3b488aBB2D212dba8c01

Testnet Contracts
Sepolia
endpointID: 40161

Contract Address

FeeLibV1ETH.sol 0x273e333dd2C17D7fe9822322fAdBBfcBe47b8132
FeeLibV1USDC.sol 0xE66B2eFfbc756076fFd1aDaA21Ed5C8FB75eF929

FeeLibV1USDT.sol 0x32F4d65b9DF20480242f40D8A1dfC57145AdEE39

StargateMultiRewarder.sol 0x94986cd528d7e17870263dB8FF0fF33e8B1363FD

StargatePoolNative.sol 0xa5A8481790BB57CF3FA0a4f24Dc28121A491447f

StargatePoolUSDC.sol 0xa4e97dFd56E0E30A2542d666Ef04ACC102310083

StargatePoolUSDT.sol 0xc9c7A3Ae8F1059867247a009b32Ad7AAD9a52D1c

StargateStaking.sol 0xF39a1dC4018a8106b21547C84133Ea122FE2b1DB

TokenMessaging.sol 0xe5EcECEc372382A96Fe8E88fDC52f327e0895245

Treasurer.sol 0xa97D0D74A756cbEEFC79697B66E90fB141F436b8

BNB Testnet
endpointID: 40102

Contract Address

FeeLibV1USDT.sol 0x95512Dd7a21Be88a7CDBA8B4647FB3fb0Efa2855

StargateMultiRewarder.sol 0x55584d5F0E466a5f57d5149647c15c2E99493E74

StargatePoolUSDT.sol 0x0a0C1221f451Ac54Ef9F21940569E252161a2495

StargateStaking.sol 0x3A7f2580675CEEd079b433C3c00EA997A31fB686

TokenMessaging.sol 0x1A2dC7f4a90a1266a9C66191CcDB2961a5BdD2ee

Treasurer.sol 0x4c61E84376F449ABB2B08eE67eD0f56aA5E6bC6E

Arbitrum Sepolia Testnet


endpointID: 40231

Contract Address

FeeLibV1ETH.sol 0x14ae7853Cd69dfd519899a30AA8bA30FA4536453

FeeLibV1USDC.sol 0xBd63EDc97649ad7F9e3D4063D24AA76ecf83767c
FeeLibV1USDT.sol 0xf375a930168b5890407B200336c6a76b2F3243c8

StargateMultiRewarder.sol 0xc9c7A3Ae8F1059867247a009b32Ad7AAD9a52D1c

StargatePoolNative.sol 0x1E8A86EcC9dc41106d3834c6F1033D86939B1e0D

StargatePoolUSDC.sol 0x0d7aB83370b492f2AB096c80111381674456e8d8

StargatePoolUSDT.sol 0xC48c0736C8ae67A8C54DFb01D7ECc7190C12a042

StargateStaking.sol 0xB15a3F6E64D2CaffAF7927431AB0D1c21e42964

TokenMessaging.sol 0xCf26A197b5353ff886919c2a2FB4c45FE233DD3f

Treasurer.sol 0x5E6a88BB6AaD9346eC70d0E28fd822037A26FFDD

Optimism Sepolia Testnet


endpointID: 40232

Contract Address

FeeLibV1ETH.sol 0x6C90B6EDdFCD46818061Aa1Fe13CC30c676e276E

FeeLibV1USDC.sol 0x14ae7853Cd69dfd519899a30AA8bA30FA4536453

FeeLibV1USDT.sol 0xBd63EDc97649ad7F9e3D4063D24AA76ecf83767c

StargateMultiRewarder.sol 0xa4e97dFd56E0E30A2542d666Ef04ACC102310083

StargatePoolNative.sol 0x3C0Dea5955cb490F78e330A213c960cA63f66314

StargatePoolUSDC.sol 0x1E8A86EcC9dc41106d3834c6F1033D86939B1e0D

StargatePoolUSDT.sol 0x0d7aB83370b492f2AB096c80111381674456e8d8

StargateStaking.sol 0xf375a930168b5890407B200336c6a76b2F3243c8

TokenMessaging.sol 0xC48c0736C8ae67A8C54DFb01D7ECc7190C12a042

Treasurer.sol 0xe5EcECEc372382A96Fe8E88fDC52f327e0895245

Klaytn Baobab Testnet


endpointID: 40150
Contract Address

FeeLibV1ETH.sol 0xcDD249F414D36594121379bC04bad085cC27F271

FeeLibV1USDC.sol 0x9352001271a0af0d09a4e7F6C431663A2D5AA9d2

FeeLibV1USDT.sol 0x3C0Dea5955cb490F78e330A213c960cA63f66314

OFTTokenETH.sol 0xE26d6ABA383A7f452D3f66B9A4a51A1dfe79DF2E

StargateOFTETH.sol 0xf1b69ee3097c6E8CC6487B7667dB818FeDC7b1a9

StargateOFTUSDC.sol 0xe19525580913971d220dBa3BbD01eE2A0b1adc6F

StargateOFTUSDC.sol 0xe19525580913971d220dBa3BbD01eE2A0b1adc6F

TokenMessaging.sol 0x6C2d1Dc35C69296C0a1661D9f1c757d6Fc3080E8

Treasurer.sol 0x1E8A86EcC9dc41106d3834c6F1033D86939B1e0D

Asset IDs
Pool Assets
Ethereum
Asset ID lpTokenSymbol

USDC 1 S*USDC

USDT 2 S*USDT

ETH 13 S*ETH

METIS 17 S*METIS

mETH 22 S*mETH

BNB Chain
Asset ID lpTokenSymbol

USDT 2 S*USDT

Avalanche
Asset ID lpTokenSymbol

USDC 1 S*USDC
USDT 2 S*USDT

Polygon
Asset ID lpTokenSymbol

USDC 1 S*USDC

USDT 2 S*USDT

Arbitrum
Asset ID lpTokenSymbol

USDC 1 S*USDC

USDT 2 S*USDT

ETH 13 S*ETH

Optimism
Asset ID lpTokenSymbol

USDC 1 S*USDC

USDT 2 S*USDT

ETH 13 S*ETH

Metis
Asset ID lpTokenSymbol

m.USDT 2 S*USDT

WETH 13 S*WETH

METIS 17 S*METIS

Linea
Asset ID lpTokenSymbol

ETH 13 S*ETH

Mantle
Asset ID lpTokenSymbol

USDC 1 S*USDC
USDT 2 S*USDT

WETH 13 S*WETH

mETH 22 S*mETH

Base
Asset ID lpTokenSymbol

USDC 1 S*USDC

ETH 13 S*ETH

Kava
Asset ID lpTokenSymbol

USDT 2 S*USDT

Scroll
Asset ID lpTokenSymbol

USDC.e 1 S*USDC.e

ETH 13 S*ETH

Aurora
Asset ID lpTokenSymbol

USDC 1 S*USDC

(V2) Supported Networks and Assets


Pool Assets
Ethereum
Asset Decimals Contract Address

USDC 6 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

USDT 6 0xdac17f958d2ee523a2206206994597c13d831ec7

ETH 18 -

METIS 18 0x9e32b13ce7f2e80a01932b42553652e053d6ed8e

mETH 18 0xd5f7838f5c461feff7fe49ea5ebaf7728bb0adfa
BNB Chain
Asset Decimals Contract Address

USDT 18 0x55d398326f99059fF775485246999027B3197955

Avalanche
Asset Decimals Contract Address

USDC 6 0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e

USDT 6 0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7

Polygon
Asset Decimals Contract Address

USDC 6 0x3c499c542cef5e3811e1192ce70d8cc03d5c3359

USDT 6 0xc2132d05d31c914a87c6611c10748aeb04b58e8f

Arbitrum
Asset Decimals Contract Address

USDC 6 0xaf88d065e77c8cc2239327c5edb3a432268e5831

USDT 6 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9

ETH -

Optimism
Asset Decimals Contract Address

USDC 6 0x0b2c639c533813f4aa9d7837caf62653d097ff85

USDT 6 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58

ETH -

Metis
Asset Decimals Contract Address

m.USDT 6 0xbb06dca3ae6887fabf931640f67cab3e3a16f4dc

WETH 18 0x420000000000000000000000000000000000000a

METIS 18 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000

Linea
Asset Decimals Contract Address

ETH 18 -

Mantle
Asset Decimals Contract Address

USDC 6 0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9

USDT 6 0x201eba5cc46d216ce6dc03f6a759e8e766e956ae

WETH 18 0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111

mETH 18 0xcda86a272531e8640cd7f1a92c01839911b90bb0

Base
Asset Decimals Contract Address

USDC 6 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913

ETH 18 -

Kava
Asset Decimals Contract Address

USDT 6 0x919c1c267bc06a7039e03fcc2ef738525769109c

Scroll
Asset Decimals Contract Address

USDC.e 6 0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4

ETH 18 -

Aurora
Asset Decimals Contract Address

USDC 6 0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7

zkSync Era (Coming Soon...)


Asset Decimals Contract Address

USDC 6 0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4

ETH 18 -

Hydra Supported Assets


Klaytn
Asset Decimals Contract Address

USDC 6 0xe2053bcf56d2030d2470fb454574237cf9ee3d4b

USDT 6 0x9025095263d1e548dc890a7589a4c78038ac40ab

WETH 18 0x55acee547df909cf844e32dd66ee55a6f81dc71b

Iota
Asset Decimals Contract Address

USDC 6 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6

USDT 6 0xC1B8045A6ef2934Cf0f78B0dbD489969Fa9Be7E4

WETH 18 0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8

Taiko
Asset Decimals Contract Address

USDC 6 0x19e26B0638bf63aa9fa4d14c6baF8D52eBE86C5C

USDT 6 0x9c2dc7377717603eB92b2655c5f2E7997a4945BD

Rari Chain
Asset Decimals Contract Address

USDC 6 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6

USDT 6 0x362FAE9A75B27BBc550aAc28a7c1F96C8D483120

Sei
Asset Decimals Contract Address

WETH 18 0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8

Flare
Asset Decimals Contract Address

USDC 6 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6

USDT 6 0x0B38e83B86d491735fEaa0a791F65c2B99535396

WETH 18 0x1502FA4be69d526124D453619276FacCab275d3D

You might also like