Skip to content

Commit

Permalink
Merge pull request #83 from immutable/SMR-2235/document/flow-rate-par…
Browse files Browse the repository at this point in the history
…ameters

Document flow rate parameters
  • Loading branch information
ermyas authored Jan 30, 2024
2 parents b37bcdd + fd3eef1 commit 768610b
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe
version: nightly

- name: Run Forge build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe
version: nightly

- name: Run install
uses: borales/actions-yarn@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe
version: nightly

- name: Run Forge fmt --check
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe
version: nightly

- name: Run Forge build
run: |
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The Immutable token bridge facilitates the transfer of assets between two chains
* [Build and Test](#build-and-test)
* [Contract Deployment](#contract-deployment)
* [Deployed Contract Addresses](#deployed-contract-addresses)
* [Flow Rate Parameters](#flow-rate-parameters)
* [Audits](#audits)
<!-- TOC -->

Expand Down Expand Up @@ -149,5 +150,31 @@ ABIs for contracts can be obtained from the blockchain explorer links for each c
| USDC | [`0x6de8aCC0D406837030CE4dd28e7c08C5a96a30d2`](https://explorer.immutable.com/address/0x6de8aCC0D406837030CE4dd28e7c08C5a96a30d2) | [`0x3B2d8A1931736Fc321C24864BceEe981B11c3c57`](https://explorer.testnet.immutable.com/address/0x3B2d8A1931736Fc321C24864BceEe981B11c3c57) |
| USDT | [`0x68bcc7F1190AF20e7b572BCfb431c3Ac10A936Ab`](https://explorer.immutable.com/address/0x68bcc7F1190AF20e7b572BCfb431c3Ac10A936Ab) | TBA |
| Wrapped BTC | [`0x235F9A2Dc29E51cE7D103bcC5Dfb4F5c9c3371De`](https://explorer.immutable.com/address/0x235F9A2Dc29E51cE7D103bcC5Dfb4F5c9c3371De) | TBA |

## Flow Rate Parameters
Below are the [flow rate](https://github.com/immutable/zkevm-bridge-contracts/blob/documentation/docs/HLA-and-Threat-Model.md#flow-rate-detection) parameters that have been configured on the L1 Mainnet and Testnet deployments.

**Mainnet**

| Token | Units | Capacity | Refill Rate | Large Transfer Threshold |
|-----------------------------------------------------------------------------------------------------|:------|----------|-------------|--------------------------|
| ETH | 10^18 | 10.08 | 0.0028 | 5.04 |
| [IMX](https://etherscan.io/token/0xf57e7e7c23978c3caec3c3548e3d615c346e79f) | 10^18 | 10,008 | 2.78 | 5,004 |
| [USDC](https://etherscan.io/token/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) | 10^6 | 20,016 | 5.56 | 10,008 |
| [Gods Unchained (GODS)](https://etherscan.io/address/0xccC8cb5229B0ac8069C51fd58367Fd1e622aFD97) | 10^18 | TBA | TBA | TBA |
| [Guild of Guardians (GOG)](https://etherscan.io/address/0x9AB7bb7FdC60f4357ECFef43986818A2A3569c62) | 10^18 | TBA | TBA | TBA |

**Testnet**

| Token | Units | Capacity | Refill Rate | Large Transfer Threshold |
|----------------------------------------------------------------------------------------|:------|----------|-------------|--------------------------|
| ETH | 10^18 | 10.08 | 0.0028 | 5.04 |
| [IMX](https://sepolia.etherscan.io/address/0xe2629e08f4125d14e446660028bd98ee60ee69ff) | 10^18 | 68,976 | 19.16 | 34,488 |
| [USDC](https://etherscan.io/token/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) | 10^6 | TBA | TBA | TBA |
| [Gods Unchained (GODS)]() | 10^18 | TBA | TBA | TBA |
| [Guild of Guardians (GOG)]() | 10^18 | TBA | TBA | TBA |



## Audits
The Immutable token bridge has been audited by [Trail of Bits](https://www.trailofbits.com/). The audit report can be found [here](./audits/Trail-of-Bits-2023-12-14.pdf).
5 changes: 0 additions & 5 deletions test/integration/root/RootERC20BridgeFlowRate.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ contract RootERC20BridgeFlowRateIntegrationTest is
* This test uses the same code as the mapToken function does to calculate this address, so we can
* not consider it sufficient.
*/

function test_mapTokenTransfersValue() public {
address childToken =
Clones.predictDeterministicAddress(address(token), keccak256(abi.encodePacked(token)), CHILD_BRIDGE);
Expand Down Expand Up @@ -135,7 +134,6 @@ contract RootERC20BridgeFlowRateIntegrationTest is
/**
* DEPOSIT ETH
*/

function test_depositETHTransfersValue() public {
uint256 tokenAmount = 300;
setupDeposit(NATIVE_ETH, rootBridgeFlowRate, mapTokenFee, depositFee, tokenAmount, false);
Expand Down Expand Up @@ -211,7 +209,6 @@ contract RootERC20BridgeFlowRateIntegrationTest is
/**
* DEPOSIT IMX
*/

function test_depositIMXTokenTransfersValue() public {
uint256 tokenAmount = 300;

Expand Down Expand Up @@ -292,7 +289,6 @@ contract RootERC20BridgeFlowRateIntegrationTest is
/**
* DEPOSIT WETH
*/

function test_depositWETHTransfersValue() public {
uint256 tokenAmount = 300;
setupDeposit(WRAPPED_ETH, rootBridgeFlowRate, mapTokenFee, depositFee, tokenAmount, false);
Expand Down Expand Up @@ -446,7 +442,6 @@ contract RootERC20BridgeFlowRateIntegrationTest is
/**
* DEPOSIT TO
*/

function test_depositToTransfersValue() public {
uint256 tokenAmount = 300;
address recipient = address(9876);
Expand Down
7 changes: 0 additions & 7 deletions test/unit/child/ChildAxelarBridgeAdaptor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ contract ChildAxelarBridgeAdaptorUnitTest is Test, IChildAxelarBridgeAdaptorErro
/**
* INITIALIZE
*/

function test_Initialize() public {
assertEq(address(axelarAdaptor.childBridge()), address(mockChildERC20Bridge), "childBridge not set");
assertEq(axelarAdaptor.rootChainId(), ROOT_CHAIN_NAME, "rootChain not set");
Expand Down Expand Up @@ -179,7 +178,6 @@ contract ChildAxelarBridgeAdaptorUnitTest is Test, IChildAxelarBridgeAdaptorErro
/**
* EXECUTE
*/

function test_RevertIf_executeCalledWithInvalidSourceChain() public {
bytes32 commandId = bytes32("testCommandId");
bytes memory payload = abi.encodePacked("payload");
Expand Down Expand Up @@ -221,7 +219,6 @@ contract ChildAxelarBridgeAdaptorUnitTest is Test, IChildAxelarBridgeAdaptorErro
/**
* SEND MESSAGE
*/

function test_sendMessage_CallsGasService() public {
address refundRecipient = address(123);
bytes memory payload = abi.encode(WITHDRAW_SIG, address(token), address(this), address(999), 11111);
Expand Down Expand Up @@ -342,7 +339,6 @@ contract ChildAxelarBridgeAdaptorUnitTest is Test, IChildAxelarBridgeAdaptorErro
/**
* UPDATE CHILD BRIDGE
*/

function test_updateChildBridge_UpdatesChildBridge() public {
vm.startPrank(bridgeManager);
address newChildBridge = address(0x123);
Expand Down Expand Up @@ -384,7 +380,6 @@ contract ChildAxelarBridgeAdaptorUnitTest is Test, IChildAxelarBridgeAdaptorErro
/**
* UPDATE ROOT CHAIN
*/

function test_updateRootChain_UpdatesRootChain() public {
vm.startPrank(targetManager);
string memory newRootChain = "newRoot";
Expand Down Expand Up @@ -425,7 +420,6 @@ contract ChildAxelarBridgeAdaptorUnitTest is Test, IChildAxelarBridgeAdaptorErro
/**
* UPDATE ROOT BRIDGE ADAPTOR
*/

function test_updateRootBridgeAdaptor_UpdatesRootBridgeAdaptor() public {
vm.startPrank(targetManager);
string memory newAdaptor = "newAdaptor";
Expand Down Expand Up @@ -470,7 +464,6 @@ contract ChildAxelarBridgeAdaptorUnitTest is Test, IChildAxelarBridgeAdaptorErro
/**
* UPDATE GAS SERVICE
*/

function test_updateGasService_UpdatesGasService() public {
vm.startPrank(gasServiceManager);
address newGasService = address(0x123);
Expand Down
8 changes: 0 additions & 8 deletions test/unit/child/ChildERC20Bridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* RECEIVE
*/

function test_NativeTransferFromWIMX() public {
address caller = address(0x123a);
payable(caller).transfer(2 ether);
Expand Down Expand Up @@ -107,7 +106,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* TREASURY DEPOSIT
*/

function test_treasuryDepostIncreasesBalance() public {
vm.deal(treasuryManager, 100 ether);
vm.startPrank(treasuryManager);
Expand Down Expand Up @@ -150,7 +148,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* INITIALIZE
*/

function test_Initialize() public {
assertEq(address(childBridge.childBridgeAdaptor()), address(address(this)), "bridgeAdaptor not set");
assertEq(childBridge.childTokenTemplate(), address(childTokenTemplate), "childTokenTemplate not set");
Expand Down Expand Up @@ -257,7 +254,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* UPDATE CHILD BRIDGE ADAPTOR
*/

function test_updateChildBridgeAdaptor_UpdatesChildBridgeAdaptor() public {
address newAdaptorAddress = address(0x11111);

Expand Down Expand Up @@ -298,7 +294,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* ON MESSAGE RECIEVE
*/

function test_onMessageReceive_SetsTokenMapping() public {
address predictedChildToken = Clones.predictDeterministicAddress(
address(childTokenTemplate), keccak256(abi.encodePacked(rootToken)), address(childBridge)
Expand Down Expand Up @@ -387,7 +382,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* DEPOSIT ETH
*/

function test_RevertsIf_OnMessageReceiveWhenPaused() public {
pause(IPausable(address(childBridge)));
bytes memory depositData =
Expand Down Expand Up @@ -461,7 +455,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* DEPOSIT
*/

function test_onMessageReceive_DepositIMX_EmitsIMXDepositEvent() public {
uint256 fundedAmount = 10 ether;
vm.deal(address(childBridge), fundedAmount);
Expand Down Expand Up @@ -616,7 +609,6 @@ contract ChildERC20BridgeUnitTest is Test, IChildERC20BridgeEvents, IChildERC20B
/**
* WITHDRAW
*/

function test_RevertIf_WithdrawReentered() public {
// Create attack token
vm.startPrank(address(childBridge));
Expand Down
1 change: 0 additions & 1 deletion test/unit/child/withdrawals/ChildERC20BridgeWithdraw.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ contract ChildERC20BridgeWithdrawUnitTest is Test, IChildERC20BridgeEvents, IChi
/**
* WITHDRAW
*/

function test_RevertsIf_WithdrawWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ contract ChildERC20BridgeWithdrawETHUnitTest is Test, IChildERC20BridgeEvents, I
/**
* WITHDRAW ETH
*/

function test_RevertsIf_WithdrawETHWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ contract ChildERC20BridgeWithdrawETHToUnitTest is Test, IChildERC20BridgeEvents,
/**
* WITHDRAW ETH TO
*/

function test_RevertsIf_WithdrawETHToWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ contract ChildERC20BridgeWithdrawIMXUnitTest is Test, IChildERC20BridgeEvents, I
/**
* WITHDRAW IMX
*/

function test_RevertIf_WithdrawIMXWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ contract ChildERC20BridgeWithdrawIMXToUnitTest is Test, IChildERC20BridgeEvents,
/**
* WITHDRAW IMX TO
*/

function test_RevertsIf_WithdrawIMXToWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ contract ChildERC20BridgeWithdrawToUnitTest is Test, IChildERC20BridgeEvents, IC
/**
* WITHDRAW TO
*/

function test_RevertsIf_WithdrawToWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ contract ChildERC20BridgeWithdrawWIMXUnitTest is Test, IChildERC20BridgeEvents,
/**
* WITHDRAW WIMX
*/

function test_RevertsIf_WithdrawWIMXWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ contract ChildERC20BridgeWithdrawWIMXToUnitTest is Test, IChildERC20BridgeEvents
/**
* WITHDRAW WIMX TO
*/

function test_RevertsIf_WithdrawWIMXToWhenPaused() public {
pause(IPausable(address(childBridge)));
vm.expectRevert("Pausable: paused");
Expand Down
6 changes: 0 additions & 6 deletions test/unit/root/RootAxelarBridgeAdaptor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ contract RootAxelarBridgeAdaptorTest is Test, IRootAxelarBridgeAdaptorEvents, IR
/**
* INITIALIZE
*/

function test_Initialize() public {
assertEq(address(axelarAdaptor.rootBridge()), address(stubRootBridge), "rootBridge not set");
assertEq(axelarAdaptor.childChainId(), CHILD_CHAIN_NAME, "childChain not set");
Expand Down Expand Up @@ -281,7 +280,6 @@ contract RootAxelarBridgeAdaptorTest is Test, IRootAxelarBridgeAdaptorEvents, IR
/**
* MAP TOKEN
*/

function test_RevertIf_mapTokenCalledByNonRootBridge() public {
address payable prankster = payable(address(0x33));
uint256 value = 300;
Expand All @@ -304,7 +302,6 @@ contract RootAxelarBridgeAdaptorTest is Test, IRootAxelarBridgeAdaptorEvents, IR
/**
* UPDATE ROOT BRIDGE
*/

function test_updateRootBridge_UpdatesRootBridge() public {
vm.startPrank(bridgeManager);
address newRootBridge = address(0x3333);
Expand Down Expand Up @@ -344,7 +341,6 @@ contract RootAxelarBridgeAdaptorTest is Test, IRootAxelarBridgeAdaptorEvents, IR
/**
* UPDATE CHILD CHAIN
*/

function test_updateChildChain_UpdatesChildChain() public {
vm.startPrank(targetManager);
string memory newChildChain = "newChildChain";
Expand Down Expand Up @@ -384,7 +380,6 @@ contract RootAxelarBridgeAdaptorTest is Test, IRootAxelarBridgeAdaptorEvents, IR
/**
* UPDATE CHILD BRIDGE ADAPTOR
*/

function test_updateChildBridgeAdaptor_UpdatesChildBridgeAdaptor() public {
vm.startPrank(targetManager);

Expand Down Expand Up @@ -428,7 +423,6 @@ contract RootAxelarBridgeAdaptorTest is Test, IRootAxelarBridgeAdaptorEvents, IR
/**
* UPDATE GAS SERVICE
*/

function test_updateGasService_UpdatesGasService() public {
vm.startPrank(gasServiceManager);
address newGasService = address(0x3333);
Expand Down
Loading

0 comments on commit 768610b

Please sign in to comment.