diff --git a/foundry/src/TychoRouter.sol b/foundry/src/TychoRouter.sol index 62a2b0c..73bca57 100644 --- a/foundry/src/TychoRouter.sol +++ b/foundry/src/TychoRouter.sol @@ -35,6 +35,8 @@ contract TychoRouter is event Withdrawal( address indexed token, uint256 amount, address indexed receiver ); + event ExecutorSet(address indexed executor); + event CallbackVerifierSet(address indexed callbackVerifier); constructor(address _permit2) { permit2 = IAllowanceTransfer(_permit2); @@ -91,6 +93,7 @@ contract TychoRouter is { if (target.code.length == 0) revert TychoRouter__NonContractExecutor(); swapExecutors[target] = true; + emit ExecutorSet(target); } /** @@ -114,6 +117,7 @@ contract TychoRouter is { if (target.code.length == 0) revert TychoRouter__NonContractVerifier(); callbackVerifiers[target] = true; + emit CallbackVerifierSet(target); } /** diff --git a/foundry/test/TychoRouter.t.sol b/foundry/test/TychoRouter.t.sol index 79bb26e..d261c60 100644 --- a/foundry/test/TychoRouter.t.sol +++ b/foundry/test/TychoRouter.t.sol @@ -14,6 +14,9 @@ contract TychoRouterTest is TychoRouterTestTemplate { bytes32 public constant FUND_RESCUER_ROLE = 0x912e45d663a6f4cc1d0491d8f046e06c616f40352565ea1cdb86a0e1aaefa41b; + event ExecutorSet(address indexed executor); + event CallbackVerifierSet(address indexed callbackVerifier); + function setupTychoRouter() public { deployTychoRouter(); } @@ -23,6 +26,10 @@ contract TychoRouterTest is TychoRouterTestTemplate { deployDummyContract(); vm.startPrank(executorSetter); + vm.expectEmit(); + // Define the event we expect to be emitted at the next step + emit ExecutorSet(DUMMY); + tychoRouter.setSwapExecutor(DUMMY); vm.stopPrank(); @@ -82,6 +89,10 @@ contract TychoRouterTest is TychoRouterTestTemplate { deployDummyContract(); vm.startPrank(executorSetter); + vm.expectEmit(); + // Define the event we expect to be emitted at the next step + emit CallbackVerifierSet(DUMMY); + tychoRouter.setCallbackVerifier(DUMMY); vm.stopPrank();