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:

    1. A → FRIC switch

    2. 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:

  1. Creation: When a user wants to exchange tokens, they create a contribution targeting one or more offers

  2. Token Flow: The user provides an input token (Token A) and receives an output token (Token B)

  3. 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

  1. Premium Application: During the exchange, any premium rate set by the switch owner is applied

  2. Whitelist Verification: For private switches, the user's address is verified against the merkle root

  3. Fulfillment: The contribution either partially or fully fulfills the targeted offers

  4. 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:

  1. Base Amount: The primary amount of tokens the contributor will receive.

  2. 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.

  3. Total Amount: The sum of the base amount and premium.

  4. Contributor Fee: A percentage of the total amount that is deducted and sent to the fee recipient. The contributor receives.

  5. 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