From 7460fd6c98edf7a57303313f277ac3e3bfe89081 Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 25 Sep 2024 17:37:47 +0200 Subject: [PATCH] events --- v2/contracts/evm/ERC20Custody.sol | 2 ++ v2/contracts/evm/GatewayEVM.sol | 2 ++ v2/contracts/evm/interfaces/IERC20Custody.sol | 4 ++++ v2/contracts/evm/interfaces/IGatewayEVM.sol | 4 ++++ v2/test/ERC20Custody.t.sol | 2 ++ v2/test/GatewayEVM.t.sol | 2 ++ 6 files changed, 16 insertions(+) diff --git a/v2/contracts/evm/ERC20Custody.sol b/v2/contracts/evm/ERC20Custody.sol index 6bf396792..7f957aa3a 100644 --- a/v2/contracts/evm/ERC20Custody.sol +++ b/v2/contracts/evm/ERC20Custody.sol @@ -65,6 +65,8 @@ contract ERC20Custody is IERC20Custody, ReentrancyGuard, AccessControl, Pausable function updateTSSAddress(address newTSSAddress) external onlyRole(TSS_UPDATER_ROLE) { if (newTSSAddress == address(0)) revert ZeroAddress(); tssAddress = newTSSAddress; + + emit UpdatedCustodyTSSAddress(newTSSAddress); } /// @notice Unpause contract. diff --git a/v2/contracts/evm/GatewayEVM.sol b/v2/contracts/evm/GatewayEVM.sol index 04c8a0171..f54f217ac 100644 --- a/v2/contracts/evm/GatewayEVM.sol +++ b/v2/contracts/evm/GatewayEVM.sol @@ -89,6 +89,8 @@ contract GatewayEVM is function updateTSSAddress(address newTSSAddress) external onlyRole(TSS_UPDATER_ROLE) { if (newTSSAddress == address(0)) revert ZeroAddress(); tssAddress = newTSSAddress; + + emit UpdatedGatewayTSSAddress(newTSSAddress); } /// @notice Pause contract. diff --git a/v2/contracts/evm/interfaces/IERC20Custody.sol b/v2/contracts/evm/interfaces/IERC20Custody.sol index 3d3402acd..1feda3416 100644 --- a/v2/contracts/evm/interfaces/IERC20Custody.sol +++ b/v2/contracts/evm/interfaces/IERC20Custody.sol @@ -40,6 +40,10 @@ interface IERC20CustodyEvents { /// @notice Emitted in legacy deposit method. event Deposited(bytes recipient, IERC20 indexed asset, uint256 amount, bytes message); + + /// @notice Emitted when tss address is updated + /// @param newTSSAddress new tss address + event UpdatedCustodyTSSAddress(address newTSSAddress); } /// @title IERC20CustodyErrors diff --git a/v2/contracts/evm/interfaces/IGatewayEVM.sol b/v2/contracts/evm/interfaces/IGatewayEVM.sol index ff91df1fa..28fbb85d5 100644 --- a/v2/contracts/evm/interfaces/IGatewayEVM.sol +++ b/v2/contracts/evm/interfaces/IGatewayEVM.sol @@ -49,6 +49,10 @@ interface IGatewayEVMEvents { /// @param payload The calldata passed to the call. /// @param revertOptions Revert options. event Called(address indexed sender, address indexed receiver, bytes payload, RevertOptions revertOptions); + + /// @notice Emitted when tss address is updated + /// @param newTSSAddress new tss address + event UpdatedGatewayTSSAddress(address newTSSAddress); } /// @title IGatewayEVMErrors diff --git a/v2/test/ERC20Custody.t.sol b/v2/test/ERC20Custody.t.sol index a4aa728ad..2321293b8 100644 --- a/v2/test/ERC20Custody.t.sol +++ b/v2/test/ERC20Custody.t.sol @@ -83,6 +83,8 @@ contract ERC20CustodyTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IReceiv function testTSSUpgrade() public { vm.startPrank(owner); + vm.expectEmit(true, true, true, true, address(custody)); + emit UpdatedCustodyTSSAddress(tssAddress); custody.updateTSSAddress(tssAddress); address newTssAddress = custody.tssAddress(); assertEq(newTssAddress, tssAddress); diff --git a/v2/test/GatewayEVM.t.sol b/v2/test/GatewayEVM.t.sol index a3d36a536..9df944210 100644 --- a/v2/test/GatewayEVM.t.sol +++ b/v2/test/GatewayEVM.t.sol @@ -82,6 +82,8 @@ contract GatewayEVMTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IReceiver function testTSSUpgrade() public { vm.startPrank(owner); + vm.expectEmit(true, true, true, true, address(gateway)); + emit UpdatedGatewayTSSAddress(tssAddress); gateway.updateTSSAddress(tssAddress); address newTssAddress = gateway.tssAddress(); assertEq(newTssAddress, tssAddress);