diff --git a/packages/horizon/contracts/data-service/extensions/DataServiceRescuable.sol b/packages/horizon/contracts/data-service/extensions/DataServiceRescuable.sol index 081950b8d..0d2f0750d 100644 --- a/packages/horizon/contracts/data-service/extensions/DataServiceRescuable.sol +++ b/packages/horizon/contracts/data-service/extensions/DataServiceRescuable.sol @@ -70,6 +70,6 @@ abstract contract DataServiceRescuable is DataService, IDataServiceRescuable { if (Denominations.isNativeToken(_token)) Address.sendValue(payable(_to), _tokens); else SafeERC20.safeTransfer(IERC20(_token), _to, _tokens); - emit TokensRescued(msg.sender, _to, _tokens); + emit TokensRescued(msg.sender, _to, _token, _tokens); } } diff --git a/packages/horizon/contracts/data-service/interfaces/IDataServiceRescuable.sol b/packages/horizon/contracts/data-service/interfaces/IDataServiceRescuable.sol index 811d3b92e..0c5b2c8f6 100644 --- a/packages/horizon/contracts/data-service/interfaces/IDataServiceRescuable.sol +++ b/packages/horizon/contracts/data-service/interfaces/IDataServiceRescuable.sol @@ -11,8 +11,12 @@ import { IDataService } from "./IDataService.sol"; interface IDataServiceRescuable is IDataService { /** * @notice Emitted when tokens are rescued from the contract. + * @param from The address initiating the rescue + * @param to The address receiving the rescued tokens + * @param token The address of the token being rescued + * @param tokens The amount of tokens rescued */ - event TokensRescued(address indexed from, address indexed to, uint256 tokens); + event TokensRescued(address indexed from, address indexed to, address indexed token, uint256 tokens); /** * @notice Emitted when a rescuer is set. diff --git a/packages/horizon/contracts/interfaces/IPaymentsEscrow.sol b/packages/horizon/contracts/interfaces/IPaymentsEscrow.sol index 47d5c8308..b480f3c31 100644 --- a/packages/horizon/contracts/interfaces/IPaymentsEscrow.sol +++ b/packages/horizon/contracts/interfaces/IPaymentsEscrow.sol @@ -38,8 +38,15 @@ interface IPaymentsEscrow { * @notice Emitted when a payer authorizes a collector to collect funds * @param payer The address of the payer * @param collector The address of the collector + * @param addedAllowance The amount of tokens added to the collector's allowance + * @param newTotalAllowance The new total allowance after addition */ - event AuthorizedCollector(address indexed payer, address indexed collector); + event AuthorizedCollector( + address indexed payer, + address indexed collector, + uint256 addedAllowance, + uint256 newTotalAllowance + ); /** * @notice Emitted when a payer thaws a collector diff --git a/packages/horizon/contracts/payments/PaymentsEscrow.sol b/packages/horizon/contracts/payments/PaymentsEscrow.sol index 57231b60a..bd6bd0ad1 100644 --- a/packages/horizon/contracts/payments/PaymentsEscrow.sol +++ b/packages/horizon/contracts/payments/PaymentsEscrow.sol @@ -84,7 +84,7 @@ contract PaymentsEscrow is Initializable, MulticallUpgradeable, GraphDirectory, require(allowance != 0, PaymentsEscrowInvalidZeroTokens()); Collector storage collector = authorizedCollectors[msg.sender][collector_]; collector.allowance += allowance; - emit AuthorizedCollector(msg.sender, collector_); + emit AuthorizedCollector(msg.sender, collector_, allowance, collector.allowance); } /** diff --git a/packages/horizon/test/escrow/collector.t.sol b/packages/horizon/test/escrow/collector.t.sol index 3e5b71bc0..ed5c05384 100644 --- a/packages/horizon/test/escrow/collector.t.sol +++ b/packages/horizon/test/escrow/collector.t.sol @@ -16,7 +16,12 @@ contract GraphEscrowCollectorTest is GraphEscrowTest { function _approveCollector(uint256 tokens) internal { (uint256 beforeAllowance,) = escrow.authorizedCollectors(users.gateway, users.verifier); vm.expectEmit(address(escrow)); - emit IPaymentsEscrow.AuthorizedCollector(users.gateway, users.verifier); + emit IPaymentsEscrow.AuthorizedCollector( + users.gateway, // payer + users.verifier, // collector + tokens, // addedAllowance + beforeAllowance + tokens // newTotalAllowance after the added allowance + ); escrow.approveCollector(users.verifier, tokens); (uint256 allowance, uint256 thawEndTimestamp) = escrow.authorizedCollectors(users.gateway, users.verifier); assertEq(allowance - beforeAllowance, tokens);