Skip to main content

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
_debridgeId
bytes32
required
Unique identifier for the bridged asset
This function:
  1. Calculates available fees (collected - withdrawn)
  2. Calls DeBridgeGate.withdrawFee()
  3. Transfers fees to treasury address

Fee Collection Flow

1

Fees Accumulate

Users pay fees when sending assets cross-chain. Fees accumulate in DeBridgeGate.
2

Withdrawal Trigger

FeeProxy.withdrawFee() is called (manually or automatically)
3

Transfer to Treasury

Fees are transferred from DeBridgeGate through FeeProxy to the treasury

Configuration

treasury
address
Address that receives withdrawn fees
deBridgeGate
address
DeBridgeGate contract address

Admin Functions

setTreasury

function setTreasury(address _treasury) external onlyAdmin
Updates the treasury address.

Usage Example

Withdraw Fees
// 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

Withdraw Multiple Assets
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:
Check Available Fees
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

Build docs developers (and LLMs) love