From 1aea3e460d93bb14d5a36da48f650828192190f9 Mon Sep 17 00:00:00 2001 From: gmehta2 <39961155+gmehta2@users.noreply.github.com> Date: Mon, 7 Apr 2025 15:29:25 -0400 Subject: [PATCH 1/5] Update 03-calculate-aep-fees.mdx --- .../03-aep-fee-router/03-calculate-aep-fees.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx index a332feb86b..9f9868526d 100644 --- a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx +++ b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx @@ -98,6 +98,9 @@ Certain Orbit configurations and customizations require special handling of AEP If you are an L3 or higher chain with a custom gas token, your custom gas token contract might be deployed on L2. If this L2 is not an Arbitrum chain, then the L2 token can't be transferred via the AEP Fee Router, as this would first require bridging down to Ethereum (impossible for L2-based tokens). In this instance, we recommend your chain pay fees in `ETH` by manually sending fees to an `ETH`-configured routing system. +If you've agreed with the Arbitrum Foundation to send your Custom Gas Token as payment you can use the following formula: +AEP_FEES = [ (L2BaseFee) + (L2SurplusFee) + (L1BaseFee * Daily_price_L1_to_L2_gas) + (L1SurplusFee * Daily_price_L1_to_L2_gas)  - ((L1BaseFee * Daily_price_L1_to_L2_gas) + (AssertionCosts * Daily_price_L1_to_L2_gas)  )] * 0.1 + ### Non-Ethereum L1 If your Orbit chain is deployed on a non-Ethereum L1 (e.g., Solana, BNB Chain), your fees must be manually transferred to a Foundation-controlled address. From 7f4cad2771d705445edbe5f57c63211533e33015 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 9 Apr 2025 11:55:56 -0500 Subject: [PATCH 2/5] yarn format --- .../03-aep-fee-router/03-calculate-aep-fees.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx index 9f9868526d..fbf3994474 100644 --- a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx +++ b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx @@ -98,8 +98,8 @@ Certain Orbit configurations and customizations require special handling of AEP If you are an L3 or higher chain with a custom gas token, your custom gas token contract might be deployed on L2. If this L2 is not an Arbitrum chain, then the L2 token can't be transferred via the AEP Fee Router, as this would first require bridging down to Ethereum (impossible for L2-based tokens). In this instance, we recommend your chain pay fees in `ETH` by manually sending fees to an `ETH`-configured routing system. -If you've agreed with the Arbitrum Foundation to send your Custom Gas Token as payment you can use the following formula: -AEP_FEES = [ (L2BaseFee) + (L2SurplusFee) + (L1BaseFee * Daily_price_L1_to_L2_gas) + (L1SurplusFee * Daily_price_L1_to_L2_gas)  - ((L1BaseFee * Daily_price_L1_to_L2_gas) + (AssertionCosts * Daily_price_L1_to_L2_gas)  )] * 0.1 +If you've agreed with the Arbitrum Foundation to send your Custom Gas Token as payment you can use the following formula: +AEP_FEES = [ (L2BaseFee) + (L2SurplusFee) + (L1BaseFee * Daily_price_L1_to_L2_gas) + (L1SurplusFee * Daily_price_L1_to_L2_gas)  - ((L1BaseFee * Daily_price_L1_to_L2_gas) + (AssertionCosts * Daily_price_L1_to_L2_gas)  )] \* 0.1 ### Non-Ethereum L1 From 4b8ae61c5ebe6478675fbbb0a48020caae93b3e9 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 9 Apr 2025 11:58:09 -0500 Subject: [PATCH 3/5] replaced unicode spaces, wrapped formula in code block --- .../03-aep-fee-router/03-calculate-aep-fees.mdx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx index fbf3994474..ef8e77685a 100644 --- a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx +++ b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/advanced-configurations/03-aep-fee-router/03-calculate-aep-fees.mdx @@ -99,7 +99,10 @@ Certain Orbit configurations and customizations require special handling of AEP If you are an L3 or higher chain with a custom gas token, your custom gas token contract might be deployed on L2. If this L2 is not an Arbitrum chain, then the L2 token can't be transferred via the AEP Fee Router, as this would first require bridging down to Ethereum (impossible for L2-based tokens). In this instance, we recommend your chain pay fees in `ETH` by manually sending fees to an `ETH`-configured routing system. If you've agreed with the Arbitrum Foundation to send your Custom Gas Token as payment you can use the following formula: -AEP_FEES = [ (L2BaseFee) + (L2SurplusFee) + (L1BaseFee * Daily_price_L1_to_L2_gas) + (L1SurplusFee * Daily_price_L1_to_L2_gas)  - ((L1BaseFee * Daily_price_L1_to_L2_gas) + (AssertionCosts * Daily_price_L1_to_L2_gas)  )] \* 0.1 + +``` +AEP_FEES = [ (L2BaseFee) + (L2SurplusFee) + (L1BaseFee * Daily_price_L1_to_L2_gas) + (L1SurplusFee * Daily_price_L1_to_L2_gas) - ((L1BaseFee * Daily_price_L1_to_L2_gas) + (AssertionCosts * Daily_price_L1_to_L2_gas) )] \* 0.1 +``` ### Non-Ethereum L1 From e9cb332ed3dc3cb2cf9908fe546295aa7ea33592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Blanchemain?= Date: Mon, 21 Apr 2025 09:54:18 -0700 Subject: [PATCH 4/5] fix: reformat --- .../02-use-a-custom-gas-token-rollup.mdx | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx index 309dff53a1..408004e7c2 100644 --- a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx +++ b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx @@ -37,16 +37,17 @@ The implementations included in the examples below have not undergone comprehens ::: -### 1. Manual exchange rate +### 1. Manual exchange rate + The Chain Owner manually sets and updates the exchange rate; this is the simplest option but requires manual updates to track price changes or dependence on an owner-defined oracle. - This approach generally makes sense if: +This approach generally makes sense if: - - You, as the chain owner, want full control over the exchange rate - - The chain owner and the batch poster are the same entity - - You are operating in a tightly controlled or experimental environment +- You, as the chain owner, want full control over the exchange rate +- The chain owner and the batch poster are the same entity +- You are operating in a tightly controlled or experimental environment - An (unaudited) example to reference is: [OwnerAdjustableExchangeRatePricer.sol](https://github.com/OffchainLabs/nitro-contracts/blob/main/test/foundry/fee-token-pricers/OwnerAdjustableExchangeRatePricer.sol) +An (unaudited) example to reference is: [OwnerAdjustableExchangeRatePricer.sol](https://github.com/OffchainLabs/nitro-contracts/blob/main/test/foundry/fee-token-pricers/OwnerAdjustableExchangeRatePricer.sol) @@ -88,16 +89,17 @@ The Chain Owner manually sets and updat ### 2. External oracle + An external oracle fetches the exchange rate; this reduces operational requirements for the chain owner but introduces a dependency on an external service to provide accurate, reliable pricing data. - This approach generally makes sense if: +This approach generally makes sense if: - - Reliable, robust oracles are available for the gas token pair - - Reducing trust in the chain owner is important for your implementation - - You, as the chain owner, want to avoid manual exchange rate updates +- Reliable, robust oracles are available for the gas token pair +- Reducing trust in the chain owner is important for your implementation +- You, as the chain owner, want to avoid manual exchange rate updates - See an (unaudited) example here using a TWAP oracle: [UniswapV2TwapPricer.sol](https://github.com/OffchainLabs/nitro-contracts/blob/main/test/foundry/fee-token-pricers/uniswap-v2-twap/UniswapV2TwapPricer.sol) - +See an (unaudited) example here using a TWAP oracle: [UniswapV2TwapPricer.sol](https://github.com/OffchainLabs/nitro-contracts/blob/main/test/foundry/fee-token-pricers/uniswap-v2-twap/UniswapV2TwapPricer.sol) + ```solidity // SPDX-License-Identifier: MIT @@ -209,30 +211,31 @@ An external oracle fetches the exchange rate; this reduces operational requireme ### 3. Exchange rate tracking + The batch poster records the rate when converting the child gas token to the parent gas token. This approach can ensure accurate reimbursement but also requires trusted reporting and more complex accounting. - This approach generally makes sense if: +This approach generally makes sense if: - - Your batch poster is trusted and willing to record exchange rates when purchasing parent chain gas - - You want reimbursement to be precise and not over- or under-charge users - - You want to minimize reliance on the chain owner or external oracles +- Your batch poster is trusted and willing to record exchange rates when purchasing parent chain gas +- You want reimbursement to be precise and not over- or under-charge users +- You want to minimize reliance on the chain owner or external oracles - Consider this (unaudited) example: [TradeTracker.sol](https://github.com/OffchainLabs/nitro-contracts/blob/main/test/foundry/fee-token-pricers/trade-tracker/TradeTracker.sol) +Consider this (unaudited) example: [TradeTracker.sol](https://github.com/OffchainLabs/nitro-contracts/blob/main/test/foundry/fee-token-pricers/trade-tracker/TradeTracker.sol) ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IFeeTokenPricer} from "../../../../src/bridge/ISequencerInbox.sol"; -import {IGasRefunder} from "../../../../src/libraries/IGasRefunder.sol"; -import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import { IFeeTokenPricer } from '../../../../src/bridge/ISequencerInbox.sol'; +import { IGasRefunder } from '../../../../src/libraries/IGasRefunder.sol'; +import { Ownable } from '@openzeppelin/contracts/access/Ownable.sol'; +import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; +import { ERC20 } from '@openzeppelin/contracts/token/ERC20/ERC20.sol'; +import { SafeERC20 } from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; abstract contract TradeTracker is IFeeTokenPricer, IGasRefunder { - using SafeERC20 for IERC20; +using SafeERC20 for IERC20; uint8 public immutable childTokenDecimals; uint256 public immutable calldataCost; @@ -318,8 +321,10 @@ abstract contract TradeTracker is IFeeTokenPricer, IGasRefunder { return amount / 10 ** (childTokenDecimals - 18); } } + } -``` + +```` An important risk for chain owners to consider is exchange rate stability. If the fee token pricer returns stale or manipulated prices, the batch poster may be under- or over-reimbursed. In the case of under-reimbursement, the batch poster would continue operating but at a loss. In the case of over-reimbursement, end users would end up overpaying transaction fees. While this risk may be acceptable for experimental or early-stage chains, you should carefully consider the financial consequences for the batch poster or end users on your Orbit chain. The “External oracle” and the “Exchange rate tracking” approaches seek to mitigate this risk. Ultimately, the chain owner should assess their unique situation when determining which fee-pricing strategy makes the most sense for them (if any). @@ -609,3 +614,4 @@ You can refer to the source files for more details on: - [fee-token-pricers](https://github.com/OffchainLabs/nitro-contracts/tree/main/test/foundry/fee-token-pricers) - [createERC20Rollup.ts](https://github.com/OffchainLabs/nitro-contracts/blob/main/scripts/createERC20Rollup.ts) You can also find more info about how Nitro manages [gas and fees](/how-arbitrum-works/09-gas-fees.mdx) here. If you’re unsure how to configure the Rollup correctly or have questions about fee pricer implementations, please get in touch with Offchain Labs or your chain’s deployment provider. +```` From 22c1a0b23ee572478e69ee5b4a4363064d9771ea Mon Sep 17 00:00:00 2001 From: Pete Date: Tue, 22 Apr 2025 14:37:36 -0500 Subject: [PATCH 5/5] yarn format --- .../common-configurations/02-use-a-custom-gas-token-rollup.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx index 8ea88bfa6c..041fd8a424 100644 --- a/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx +++ b/arbitrum-docs/launch-orbit-chain/02-configure-your-chain/common-configurations/02-use-a-custom-gas-token-rollup.mdx @@ -616,3 +616,4 @@ You can refer to the source files for more details on: - [createERC20Rollup.ts](https://github.com/OffchainLabs/nitro-contracts/blob/main/scripts/createERC20Rollup.ts) You can also find more info about how Nitro manages [gas and fees](/how-arbitrum-works/09-gas-fees.mdx) here. If you’re unsure how to configure the Rollup correctly or have questions about fee pricer implementations, please get in touch with Offchain Labs or your chain’s deployment provider. +````