Skip to content

Commit

Permalink
test: chainGasAmount deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Nov 11, 2024
1 parent b06c275 commit 4962a96
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions packages/contracts-rfq/test/FastBridgeV2.Management.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IAdmin} from "../contracts/interfaces/IAdmin.sol";
import {IAdminV2Errors} from "../contracts/interfaces/IAdminV2Errors.sol";

import {FastBridgeV2, FastBridgeV2Test} from "./FastBridgeV2.t.sol";
Expand All @@ -19,7 +20,6 @@ contract FastBridgeV2ManagementTest is FastBridgeV2Test, IAdminV2Errors {
event CancelDelayUpdated(uint256 oldCancelDelay, uint256 newCancelDelay);
event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);
event FeesSwept(address token, address recipient, uint256 amount);
event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);

function deployFastBridge() public override returns (FastBridgeV2) {
return new FastBridgeV2(admin);
Expand Down Expand Up @@ -56,11 +56,6 @@ contract FastBridgeV2ManagementTest is FastBridgeV2Test, IAdminV2Errors {
fastBridge.sweepProtocolFees(token, recipient);
}

function setChainGasAmount(address caller, uint256 newChainGasAmount) public {
vm.prank(caller);
fastBridge.setChainGasAmount(newChainGasAmount);
}

function test_grantGovernorRole() public {
assertFalse(fastBridge.hasRole(GOVERNOR_ROLE, governorA));
setGovernor(admin, governorA);
Expand Down Expand Up @@ -161,24 +156,14 @@ contract FastBridgeV2ManagementTest is FastBridgeV2Test, IAdminV2Errors {

// ═══════════════════════════════════════════ SET CHAIN GAS AMOUNT ════════════════════════════════════════════════

function test_setChainGasAmount() public {
vm.expectEmit(address(fastBridge));
emit ChainGasAmountUpdated(0, 123);
setChainGasAmount(governor, 123);
assertEq(fastBridge.chainGasAmount(), 123);
function test_chainGasAmountZero() public view {
assertEq(fastBridge.chainGasAmount(), 0);
}

function test_setChainGasAmount_twice() public {
test_setChainGasAmount();
vm.expectEmit(address(fastBridge));
emit ChainGasAmountUpdated(123, 456);
setChainGasAmount(governor, 456);
assertEq(fastBridge.chainGasAmount(), 456);
}

function test_setChainGasAmount_revertNotGovernor(address caller) public {
vm.assume(caller != governor);
expectUnauthorized(caller, fastBridge.GOVERNOR_ROLE());
setChainGasAmount(caller, 123);
function test_setChainGasAmount_revert() public {
// Generic revert: this function should not be in the V2 interface
vm.expectRevert();
vm.prank(governor);
IAdmin(address(fastBridge)).setChainGasAmount(123);
}
}

0 comments on commit 4962a96

Please sign in to comment.