Move fee abstraction docs to "Build on Celo" section#2163
Move fee abstraction docs to "Build on Celo" section#2163
Conversation
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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Add sections explaining why fee abstraction matters, how it works at the protocol level, and key use cases.
| celocli network:whitelist --node celo-sepolia | ||
|
|
||
| # Celo mainnet | ||
| celocli network:whitelist --node https://forno.celo.org |
There was a problem hiding this comment.
This could be updated to maintain consistency with the above
| 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, | ||
| }); |
There was a problem hiding this comment.
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.
| ## 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) | | ||
|
|
||
| --- | ||
|
|
There was a problem hiding this comment.
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.
Split the single fee abstraction page into three focused pages:
Update all cross-references and redirects.