diff --git a/packages/contracts-bedrock/interfaces/L2/INativeAssetLiquidity.sol b/packages/contracts-bedrock/interfaces/L2/INativeAssetLiquidity.sol index 003ac4d7bdd..a1f69399c30 100644 --- a/packages/contracts-bedrock/interfaces/L2/INativeAssetLiquidity.sol +++ b/packages/contracts-bedrock/interfaces/L2/INativeAssetLiquidity.sol @@ -5,13 +5,10 @@ import { ISemver } from "interfaces/universal/ISemver.sol"; interface INativeAssetLiquidity is ISemver { error Unauthorized(); - error InvalidAmount(); event LiquidityDeposited(address indexed caller, uint256 value); event LiquidityWithdrawn(address indexed caller, uint256 value); - event LiquidityFunded(address indexed funder, uint256 value); function deposit() external payable; function withdraw(uint256 _amount) external; - function fund() external payable; } diff --git a/packages/contracts-bedrock/snapshots/abi/NativeAssetLiquidity.json b/packages/contracts-bedrock/snapshots/abi/NativeAssetLiquidity.json index 9bbeb842723..da55b26210b 100644 --- a/packages/contracts-bedrock/snapshots/abi/NativeAssetLiquidity.json +++ b/packages/contracts-bedrock/snapshots/abi/NativeAssetLiquidity.json @@ -6,13 +6,6 @@ "stateMutability": "payable", "type": "function" }, - { - "inputs": [], - "name": "fund", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, { "inputs": [], "name": "version", @@ -58,25 +51,6 @@ "name": "LiquidityDeposited", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "funder", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "LiquidityFunded", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -96,11 +70,6 @@ "name": "LiquidityWithdrawn", "type": "event" }, - { - "inputs": [], - "name": "InvalidAmount", - "type": "error" - }, { "inputs": [], "name": "Unauthorized", diff --git a/packages/contracts-bedrock/snapshots/semver-lock.json b/packages/contracts-bedrock/snapshots/semver-lock.json index 2d4bd0e88a4..7291025b2c3 100644 --- a/packages/contracts-bedrock/snapshots/semver-lock.json +++ b/packages/contracts-bedrock/snapshots/semver-lock.json @@ -108,8 +108,8 @@ "sourceCodeHash": "0xb4fca8d4532e88e0dd53d3643aa4022953e37c745753009b3c8f9bcca5806f57" }, "src/L2/NativeAssetLiquidity.sol:NativeAssetLiquidity": { - "initCodeHash": "0x2c50c7cac8eab6867ffb969a65a8aa3026d415f2e9464726683ff6cd5da0b8f3", - "sourceCodeHash": "0x9432883dd4aa4d5ffc733ad99fa7bcc9cc8c319e654b385b8cd093a37a4c94cb" + "initCodeHash": "0x9e94f5271edad247ed8f9900aabc3fd3ce7404cc0512753a8fd10b7f1143476d", + "sourceCodeHash": "0xf991ff4d47c610778669721c68908beab4336f1eba52a7d8f6cdb8317707c481" }, "src/L2/OperatorFeeVault.sol:OperatorFeeVault": { "initCodeHash": "0x3d8c0d7736e8767f2f797da1c20c5fe30bd7f48a4cf75f376290481ad7c0f91f", diff --git a/packages/contracts-bedrock/src/L2/NativeAssetLiquidity.sol b/packages/contracts-bedrock/src/L2/NativeAssetLiquidity.sol index 859818ad6cf..893734f9055 100644 --- a/packages/contracts-bedrock/src/L2/NativeAssetLiquidity.sol +++ b/packages/contracts-bedrock/src/L2/NativeAssetLiquidity.sol @@ -11,7 +11,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; import { ISemver } from "interfaces/universal/ISemver.sol"; // Errors -import { Unauthorized, InvalidAmount } from "src/libraries/errors/CommonErrors.sol"; +import { Unauthorized } from "src/libraries/errors/CommonErrors.sol"; /// @custom:predeploy 0x4200000000000000000000000000000000000029 /// @title NativeAssetLiquidity @@ -23,9 +23,6 @@ contract NativeAssetLiquidity is ISemver { /// @notice Emitted when an address deposits native asset liquidity. event LiquidityDeposited(address indexed caller, uint256 value); - /// @notice Emitted when funds are received. - event LiquidityFunded(address indexed funder, uint256 value); - /// @notice Semantic version. /// @custom:semver 1.0.0 string public constant version = "1.0.0"; @@ -46,12 +43,4 @@ contract NativeAssetLiquidity is ISemver { emit LiquidityWithdrawn(msg.sender, _amount); } - - /// @notice Fund the contract by sending native asset. - /// @dev The function is payable to accept native asset. - function fund() external payable { - if (msg.value == 0) revert InvalidAmount(); - - emit LiquidityFunded(msg.sender, msg.value); - } } diff --git a/packages/contracts-bedrock/test/L2/NativeAssetLiquidity.t.sol b/packages/contracts-bedrock/test/L2/NativeAssetLiquidity.t.sol index 9f986912bac..d7e38b6ab37 100644 --- a/packages/contracts-bedrock/test/L2/NativeAssetLiquidity.t.sol +++ b/packages/contracts-bedrock/test/L2/NativeAssetLiquidity.t.sol @@ -8,7 +8,7 @@ import { CommonTest } from "test/setup/CommonTest.sol"; import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Error imports -import { Unauthorized, InvalidAmount } from "src/libraries/errors/CommonErrors.sol"; +import { Unauthorized } from "src/libraries/errors/CommonErrors.sol"; /// @title NativeAssetLiquidity_TestInit /// @notice Reusable test initialization for `NativeAssetLiquidity` tests. @@ -147,41 +147,3 @@ contract NativeAssetLiquidity_Withdraw_Test is NativeAssetLiquidity_TestInit { assertEq(address(liquidityController).balance, 0); } } - -/// @title NativeAssetLiquidity_Fund_Test -/// @notice Tests the `fund` function of the `NativeAssetLiquidity` contract. -contract NativeAssetLiquidity_Fund_Test is NativeAssetLiquidity_TestInit { - /// @notice Tests that the fund function succeeds when called with a non-zero value. - /// @param _amount Amount of native asset (in wei) to call the fund function with. - /// @param _caller Address of the caller to call the fund function with. - function testFuzz_fund_succeeds(uint256 _amount, address _caller) public { - _amount = bound(_amount, 1, 1000 ether); - vm.assume(_caller != address(0)); - vm.assume(_caller != address(nativeAssetLiquidity)); // Prevent contract from calling itself - - // Deal caller with the amount to fund - vm.deal(_caller, _amount); - uint256 initialContractBalance = address(nativeAssetLiquidity).balance; - - // Expect emit LiquidityFunded event - vm.expectEmit(address(nativeAssetLiquidity)); - emit LiquidityFunded(_caller, _amount); - vm.prank(_caller); - nativeAssetLiquidity.fund{ value: _amount }(); - - // Assert caller and contract balances are updated correctly - assertEq(_caller.balance, 0); - assertEq(address(nativeAssetLiquidity).balance, initialContractBalance + _amount); - } - - /// @notice Tests that the fund function reverts when called with zero value. - function test_fund_zeroAmount_reverts() public { - uint256 initialContractBalance = address(nativeAssetLiquidity).balance; - // Expect revert with InvalidAmount - vm.expectRevert(InvalidAmount.selector); - nativeAssetLiquidity.fund{ value: 0 }(); - - // Assert contract balance does not change - assertEq(address(nativeAssetLiquidity).balance, initialContractBalance); - } -}