FastBridgeInterceptor
Inherits: IFastBridgeInterceptor
Contract that enables flexible bridging with automatic price adjustment.
Enforces a maximum 1% deviation limit between quoted and actual amounts.
State Variables
MAX_ORIGIN_PCT_DIFF
Maximum allowed percentage difference (1%) from the quoted origin amount.
uint256 public constant MAX_ORIGIN_PCT_DIFF = 0.01e18;
NATIVE_GAS_TOKEN
Special address representing the native gas token (ETH).
address public constant NATIVE_GAS_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
WEI
Base unit for percentage calculations (100% = 1e18).
uint256 internal constant WEI = 1e18;
MIN_ORIGIN_PCT
Minimum allowed percentage (99%) for origin amount comparisons.
uint256 internal constant MIN_ORIGIN_PCT = WEI - MAX_ORIGIN_PCT_DIFF;
MAX_ORIGIN_PCT
Maximum allowed percentage (101%) for origin amount comparisons.
uint256 internal constant MAX_ORIGIN_PCT = WEI + MAX_ORIGIN_PCT_DIFF;
Functions
bridgeWithInterception
Bridges tokens with automatic destination amount adjustment based on actual sent amount. For ERC20 tokens: Requires token approval to this contract (not FastBridge). For ETH: Send the desired ETH amount via msg.value. Will revert if amounts differ by more than 1% or an invalid token is provided.
Handles token transfers/approvals and forwards calls to FastBridge with adjusted destination amounts.
function bridgeWithInterception(
IFastBridge.BridgeParams memory params,
InterceptorParams memory interceptorParams
)
external
payable;
Parameters
Name | Type | Description |
---|---|---|
params | IFastBridge.BridgeParams | Bridge parameters with the actual amount to bridge. |
interceptorParams | InterceptorParams | Original quote parameters used for price calculation. |