XY Finance
Search
K
💲

Get Fee Structure

get
endpoint
/yBridgeConfigs
Get Fee Structure
//quote response
{
"isSuccess": true,
"msg": "",
"config": {
"1": { // source chain
"56": { // destination chain
"USDC": { // bridge & bridge token
"bridge": {
"minimumSwapAmount": 0.7, // in bridge token
"baseFee": 0.58, // in bridge token
"protocolFee": {
"minimum": 0.1, // in bridge token
"maximum": 1000, // in bridge token
"rate": 0.0005
},
"expiredAt": 1882312672 // unix timestamp
},
"bridgeWithDstSwap": { // in bridge token
"minimumSwapAmount": 0.3, // in bridge token
"baseFee": 0.18, // in bridge token
"protocolFee": {
"minimum": 0.1, // in bridge token
"maximum": 1000, // in bridge token
"rate": 0.0005
},
"expiredAt": 1882312672 // unix timestamp
}
}
}
"10": { // destination chain
...,
}
...,
}
"56": { // source chain
...,
}
}
}
Discover more about how yBridge fees are calculated at yBridge Fee Information
The "configs" object is organized in a hierarchical structure, where "1" represents the chain ID of the source chain. Underneath the source chain, there are multiple chain ID of destination chains, such as "10," "56," "137," and others. All fee-related configurations for each bridges are disclosed under each chain pair.
Within different bridges, there are two additional scenarios to consider. The first scenario is purely a bridge operation without any DEX swaps on the destination chain, indicated as "bridge" in the response. The second scenario involves DEX swaps on the destination chain and is represented as "bridgeWithDstSwap". Both of these situations contain detailed fee configuration information, and the fee calculation follows the formula below:
BridgeFee=BaseFee+ProtocolFeeBridgeFee = BaseFee + ProtocolFee
  • minimumSwapAmount: Please ensure that your source bridge token amount is greater than this amount; otherwise, the response may result in an error.
  • baseFee: Is charged to cover the gas costs incurred when our service transfers tokens to the user's receiving address.
  • protocolFee: The protocolFee is calculated as the product of the srcBridgeTokenAmount and rate. This fee is then allocated to reward yBridge liquidity providers and XY DAO.
    • minimum: Will be charged when the product is less than the specified minimum.
      • For example: minimum: 0.5U, srcBridgeTokenAmount: 10 USDC, rate 0.0005
      • The fee amount in this case would be 0.5U, since 10*0.00050 = 0.005 is less than the minimumFee: 0.5U.
    • maximum: Will be charged when the product is more than the specified maximum.
      • For example: maximum: 1000U, srcBridgeTokenAmount: 2500000 USDC, rate 0.0005
      • The fee amount in this case would be 1000U, since 2500000*0.00050 = 1250 is more than the maximumFee: 1000U.
    • rate: Represents the proportion of the transaction amount that is charged as a fee.
      • rate: 0.00050 = 0.050%
  • expiryAt: Each pair has its own expiry time. The details in the object will no longer be usable once the expiry time has passed.
Please confirm the expiration time before it's due. The quickest we update is every 20 minutes, but it can vary.

Example:

{
"1": { // source chain
"56": { // destination chain
"USDC": {
"bridge": {
"minimumSwapAmount": 0.7,
"baseFee": 0.58,
"protocolFee": {
"minimum": 0.1,
"maximum": 1000,
"rate": 0.0005
},
"expiredAt": 123223241
},
"bridgeWithDstSwap": {
...
},
...
}
}
}
}
}
For instance, consider a user transferring 580 USDC from Ethereum (chainId: 1) to USDC on BNB (chainId: 56), using the USDC pool from yBridge. This transfer does not involve any DEX swap on the BNB Chain (the destination chain). According to the previous API response, the "srcBridgeTokenAmount" is more than 0.7U.
Fee details are as follows:
  • Base fee: 0.58U
  • Protocol fee: 580 * 0.0005 = 0.29U
  • Total fee: 0.58U + 0.29U = 0.87U
The final charge will be 0.87U, taken as pool tokens valued at 0.87 USD.