Settlement is permissionless: anyone can settle claims via fill(...).
Claims are filled in FIFO order per targetToken.
Entry point
fill(targetToken, maxClaims, calls) settles up to maxClaims claims from the queue keyed by targetToken.
High-level algorithm
-
Plan a batch
- start from the queue head (
nextIndexByTargetToken[targetToken]) - select up to
maxClaims, stopping when available hub USDT balance is exhausted - compute:
totalUsdtrequired to cover the batch (sum ofamountUsdt)expectedOutTotalif swapping is required (sum converted using configured rate)
- start from the queue head (
-
Swap once (if needed)
- if
targetToken != usdt, execute the swap via a per-hubSwapExecutor - enforce a minimum output (≥
expectedOutTotal) - return all output to the hub
- any surplus output above
expectedOutTotalis typically paid tomsg.sender(filler incentive), depending on deployment rules
- if
-
Settle claims sequentially For each claim in the batch:
- delete claim slot + locator before external interactions
- compute payout amount:
- if
targetToken == usdt:outAmount = amountUsdt - else:
outAmount = amountUsdt * ratePpm / 1e6
- if
- deliver:
- if
targetChainId != block.chainid: call a configured bridger - else: transfer directly to beneficiary
- if
Swap executor
The hub delegates swap execution to a SwapExecutor:
- fillers provide the call sequence (DEX route, aggregators, etc.),
- the hub enforces minimum output for safety.
See: EVM hub contracts.
Bridgers
When a claim’s targetChainId differs from the hub chain, the hub calls a configured bridger adapter:
- the hub transfers tokens to the bridger
- the bridger executes the cross-chain delivery
The hub does not verify destination delivery; bridgers are trusted configuration.
See: Admin & trust model.