How Contributions Work
How Contributions Work
Token Routing
The Frictionless application implements a hub-and-spoke model for token exchanges:
All token-to-token swaps route through FRIC as a paired token
When creating a switch for tokens A and B, the system creates:
A → FRIC switch
B → FRIC switch
This approach provides several benefits:
Reduces the number of required pools (from N(N-1)/2 to just N)
Creates better liquidity through the central FRIC token
Simplifies routing and contribution processing
Standardizes exchange pathways through a common medium
Contributions are the core transaction mechanism in Frictionless, representing token exchanges between users:
Creation: When a user wants to exchange tokens, they create a contribution targeting one or more offers
Token Flow: The user provides an input token (Token A) and receives an output token (Token B)
Routing: With FRIC routing architecture:
Token A is first swapped to FRIC via the A→FRIC switch

FRIC is then swapped to Token B via the FRIC→B switch

Premium Application: During the exchange, any premium rate set by the switch owner is applied
Whitelist Verification: For private switches, the user's address is verified against the merkle root
Fulfillment: The contribution either partially or fully fulfills the targeted offers
Controller Owners: The wallet that created the switch cannot create a contribution on that switch. Therefore - if wallet 0x123 created controller 123 with switch XYZ and switch ABC, then wallet 0x123 cannot create contributions on switch XYZ or switch ABC.
This two-step routing process (A→FRIC→B) happens transparently to the user, who only sees a direct A→B exchange. The FRIC token serves as an intermediary medium of exchange, creating a hub-and-spoke model that centralizes liquidity.

Contribution Fee Structure
When a contribution is made, several fee components are calculated and distributed:
Base Amount: The primary amount of tokens the contributor will receive.
Premium: An additional percentage (set by the switch owner) applied to the base amount. This premium is added to the base amount and is part of what the contributor receives.
Total Amount: The sum of the base amount and premium.
Contributor Fee: A percentage of the total amount that is deducted and sent to the fee recipient. The contributor receives.
Creator Fee: A percentage of the input amount that is deducted from what the offer creator would receive and sent to the fee recipient.
Example Transaction Flow
For a contribution with:
Base amount: 3.0 ABOND
Premium: 0.15 ABOND (5% premium)
Total amount: 3.15 ABOND
Contributor fee: 0.0315 ABOND (1% of total)
The actual token transfers would be:
Contributor receives: 3.1185 ABOND (totalAmountOut - contributorFee)
Fee recipient receives: 0.0315 ABOND (contributorFee)
Creator receives: amountIn - creatorFee (in the input token)
Fee recipient also receives: creatorFee (in the input token)
This fee structure ensures that the protocol can sustain itself while providing value to all participants in the ecosystem.
Last updated