Using Cairn
Fees
Where the 0.50% goes and where it does not apply.
When it applies
| Action | Fee |
|---|---|
| createPot | None. No tokens move. |
| contribute | None. The full amount is credited. |
| refund | None. You get back exactly what you put in. |
| cancel | None. |
| release | 0.50% of the released balance, once. |
Because the fee is only taken on release, a pot that misses its goal costs its contributors nothing beyond gas. The protocol only earns when a pot actually works.
The math
fee = (amount * feeBps) / 10_000 // a pot holding 1,000 USDG at the default 50 bps fee = 1000000000 * 50 / 10000 = 5000000 // 5 USDG payout = 1000000000 - 5000000 = 995000000 // 995 USDG
Integer division rounds down, which means the fee rounds in the beneficiary's favour, never against them. You can preview the exact number with quoteFee(beneficiary, amount) before anybody signs anything.
The cap
MAX_FEE_BPS is a constant equal to 100. It is compiled into the bytecode, not stored, so it cannot be written to by any transaction. setFee reverts with FeeTooHigh above it. The worst case for a pot on this contract, forever, is 1.00%.
A fee change applies from the block it lands in. It cannot be applied retroactively, but it does apply to pots that were created before it, since the fee is read at release time. If that matters to you, release as soon as the goal is met.
Gas
Robinhood Chain is an Arbitrum Orbit L2 with a base fee around 0.08 gwei, so every action here costs a fraction of a cent. Creating a pot is the most expensive one because it writes a name string. Contributing to a pot you have already contributed to is the cheapest.