cBridge Limit Parameters

There are certain rules limiting on source and destination chains for security purposes. When transferring assets through cBridge, it's essential to check these limit parameters beforehand.

Source Chain

1. minSend/maxSend

The sending amount range is (minSend, maxSend], for Pool-based transfer, you can get the minSend/minMax on source chain Bridge contract, the address is the token address on source chain.

The screenshot is an example to get the USDC minSend Value on Ethereum.

Note if the transfer token is ETH, use the WETH token address as the query key.

2. pool cap

The pool cap signifies the maximum volume allowed in this pool. Once the pool cap of the source chain is reached, transfers of the token from this chain are temporarily suspended until the volume decreases below the cap.

The sending amount should be matched the rule of sending amount + current volume <= pool cap

To check pool cap by handling the error in estimateAmt api when you quote the transfer.

The error code

ERROR_CODE_LIQ_OVER_CAP // 1017

Error Message:

You can transfer up to {remainning_amount} {token_symbol} at this moment. You may reduce your transfer amount. the remainning_amount = pool - current volume

(Aside) The pool cap limit value can be read from the inbound_lmt field in the configuration file.

Destination Chain

1. Big amount delay

If the sending amount is greater than an on-chain threshold, the transaction might be delayed for a while due to security reasons. You can retrieve these parameters from the destination chain.

delayThresholds: https://github.com/celer-network/sgn-v2-contracts/blob/4d742f6c337f06777947a73accd9f78239de92ee/contracts/safeguard/DelayedTransfer.sol#L15C40-L15C55

delayPeriod: https://github.com/celer-network/sgn-v2-contracts/blob/4d742f6c337f06777947a73accd9f78239de92ee/contracts/safeguard/DelayedTransfer.sol#L16C20-L16C31 indicates the transaction delay time in second.

2. Epoch volume cap

The epoch volume cap restricts the amount of volume that can be transferred on the destination chain within a specific time frame.

Example code of calculating the accumulated volume

uint256 volume = epochVolumes[_token];
uint256 epochStartTime = (timestamp / epochLength) * epochLength;
if (lastOpTimestamps[_token] < epochStartTime) {
   volume = _amount; // new epoch, the total amount is current sending amount
} else {
   volume += _amount; // last brdige is within the current time frame,last volume should be accumulated to total volume
}
require(volume <= cap, "volume exceeds cap");

You can obtain the epochVolumeCaps , lastOpTimestamps, epochLength and corresponding token epochVolumes from the VolumeControl Contract, which has been implemented by the Bridge Contract. The accumulated volume in this period must be lower than the value specified by the "epochVolumeCaps".

Last updated