Overview
FeeProxy (SimpleFeeProxy) is a helper contract that withdraws collected fees from DeBridgeGate and transfers them to the treasury. It supports both native tokens and ERC-20 tokens.
Contract Location : contracts/periphery/SimpleFeeProxy.sol
Key Functions
withdrawFee
Withdraws collected fees for a specific asset.
function withdrawFee ( bytes32 _debridgeId ) external
Unique identifier for the bridged asset
This function:
Calculates available fees (collected - withdrawn)
Calls DeBridgeGate.withdrawFee()
Transfers fees to treasury address
Fee Collection Flow
Fees Accumulate
Users pay fees when sending assets cross-chain. Fees accumulate in DeBridgeGate.
Withdrawal Trigger
FeeProxy.withdrawFee() is called (manually or automatically)
Transfer to Treasury
Fees are transferred from DeBridgeGate through FeeProxy to the treasury
Configuration
Address that receives withdrawn fees
DeBridgeGate contract address
Admin Functions
setTreasury
function setTreasury ( address _treasury ) external onlyAdmin
Updates the treasury address.
Usage Example
// Get debridgeId for USDC from Ethereum
bytes32 debridgeId = deBridgeGate. getDebridgeId (
1 , // Ethereum chain ID
usdcAddress // USDC token address
);
// Withdraw fees
feeProxy. withdrawFee (debridgeId);
// Fees are now in treasury
Batch Withdrawals
bytes32 [] memory debridgeIds = new bytes32 []( 3 );
debridgeIds[ 0 ] = ethDebridgeId;
debridgeIds[ 1 ] = usdcDebridgeId;
debridgeIds[ 2 ] = usdtDebridgeId;
for ( uint i = 0 ; i < debridgeIds.length; i ++ ) {
feeProxy. withdrawFee (debridgeIds[i]);
}
Fee Tracking
Fees can be queried before withdrawal:
DeBridgeFeeInfo memory feeInfo = deBridgeGate. getDebridgeFeeInfo (debridgeId);
uint256 collectedFees = feeInfo.collectedFees;
uint256 withdrawnFees = feeInfo.withdrawnFees;
uint256 availableFees = collectedFees - withdrawnFees;
Security
Only callable by authorized addresses
Fees can only go to designated treasury
Atomic withdrawal operations
No fee skimming or manipulation
Fee Structure Learn about protocol fees
DeBridgeGate Main bridge contract