Skip to content

Commit

Permalink
events
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Sep 25, 2024
1 parent f204ebe commit 7460fd6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions v2/contracts/evm/ERC20Custody.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions v2/contracts/evm/GatewayEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions v2/contracts/evm/interfaces/IERC20Custody.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions v2/contracts/evm/interfaces/IGatewayEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions v2/test/ERC20Custody.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions v2/test/GatewayEVM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7460fd6

Please sign in to comment.