Skip to content

Move fee abstraction docs to "Build on Celo" section#2163

Open
palango wants to merge 3 commits intomainfrom
palango/fee-abstraction
Open

Move fee abstraction docs to "Build on Celo" section#2163
palango wants to merge 3 commits intomainfrom
palango/fee-abstraction

Conversation

@palango
Copy link
Copy Markdown
Contributor

@palango palango commented Mar 26, 2026

Split the single fee abstraction page into three focused pages:

  • Overview: what fee abstraction is, allowlist, adapters
  • Using Fee Abstraction: practical guide with viem and CLI
  • Adding Fee Currencies: IFeeCurrency interface and implementation

Update all cross-references and redirects.

Split the single fee abstraction page into three focused pages:
- Overview: what fee abstraction is, allowlist, adapters
- Using Fee Abstraction: practical guide with viem and CLI
- Adding Fee Currencies: IFeeCurrency interface and implementation

Update all cross-references and redirects.
@mintlify
Copy link
Copy Markdown
Contributor

mintlify bot commented Mar 26, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
celo-docs 🟢 Ready View Preview Mar 26, 2026, 7:56 PM

Add sections explaining why fee abstraction matters, how it works
at the protocol level, and key use cases.
@palango palango marked this pull request as ready for review March 30, 2026 16:48
@palango palango requested review from a team as code owners March 30, 2026 16:48
@palango palango requested review from piersy and seolaoh and removed request for a team March 30, 2026 16:48
celocli network:whitelist --node celo-sepolia

# Celo mainnet
celocli network:whitelist --node https://forno.celo.org
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be updated to maintain consistency with the above

Suggested change
celocli network:whitelist --node https://forno.celo.org
celocli network:whitelist --node celo

const hash = await client.sendTransaction({
...{ to, data: dataAfterFeeCalculation },
feeCurrency: USDC_ADAPTER_MAINNET,
});
Copy link
Copy Markdown
Contributor

@piersy piersy Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function seems wrong.

It takes amountInWei, but only uses it to calculate the fee and then sends 1 ether - the fee.

Also it's handling USDC which has 6 decimals so accepting an amount in wei also seems wrong, and using parse ether, which also returns wei!

I find this is pretty confusing, and also unnecessarily complex for an example. I would simplify it to
an example that simply shows sending a given amount determined by the user, rather than removing the fee from the amount to send.

And possibly having one example showing using an adapted token and one example showing using a non adapted token.

Comment on lines +35 to +78
## Allowlisted Fee Currencies

The protocol maintains a governable allowlist of smart contract addresses that can be used as fee currencies. These contracts implement an extension of the ERC20 interface with additional functions for debiting and crediting transaction fees (see [Adding Fee Currencies](/build-on-celo/fee-abstraction/add-fee-currency)).

To fetch the current allowlist, call `getCurrencies()` on the `FeeCurrencyDirectory` contract, or use `celocli`:
```bash
# Celo Sepolia testnet
celocli network:whitelist --node celo-sepolia

# Celo mainnet
celocli network:whitelist --node https://forno.celo.org
```

---

## Adapters for Non-18-Decimal Tokens

After Contract Release 11, allowlisted addresses may be **adapters** rather than full ERC20 tokens. Adapters are used when a token has decimals other than 18 (e.g., USDC and USDT use 6 decimals). The Celo blockchain calculates gas pricing in 18 decimals, so adapters normalize the value.

- **For transfers**: use the token address as usual.
- **For `feeCurrency`**: use the adapter address.
- **For `balanceOf`**: querying via the adapter returns the balance as if the token had 18 decimals — useful for checking whether an account can cover gas without converting units.

To get the underlying token address for an adapter, call `adaptedToken()` on the adapter contract.

For more on gas pricing, see [Gas Pricing](/legacy/protocol/transaction/gas-pricing).

### Adapter Addresses

#### Mainnet

| Name | Token Address | Adapter Address |
| ------ | ------------- | --------------- |
| `USDC` | [`0xcebA9300f2b948710d2653dD7B07f33A8B32118C`](https://celoscan.io/address/0xcebA9300f2b948710d2653dD7B07f33A8B32118C#code) | [`0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B`](https://celoscan.io/address/0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B#code) |
| `USDT` | [`0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e`](https://celoscan.io/address/0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e#code) | [`0x0e2a3e05bc9a16f5292a6170456a710cb89c6f72`](https://celoscan.io/address/0x0e2a3e05bc9a16f5292a6170456a710cb89c6f72#code) |

#### Celo Sepolia (Testnet)

| Name | Token Address | Adapter Address |
| ------ | ------------- | --------------- |
| `USDC` | [`0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B`](https://sepolia.celoscan.io/address/0x2f25deb3848c207fc8e0c34035b3ba7fc157602b#code) | [`0x4822e58de6f5e485eF90df51C41CE01721331dC0`](https://sepolia.celoscan.io/address/0x4822e58de6f5e485eF90df51C41CE01721331dC0#code) |

---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these 2 sections (Allowlisted fee currencies & Adapters) would make more sense in the 'Using fee abstraction' page, since that is where you need to know these things. An average user has no use for this information, since fee currencies need to be explicitly supported in any app that they may be using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants