Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 token, uint256 tokens);

/**
* @notice Emitted when a rescuer is set.
Expand Down
9 changes: 8 additions & 1 deletion packages/horizon/contracts/interfaces/IPaymentsEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/horizon/contracts/payments/PaymentsEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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);
}

/**
Expand Down
7 changes: 6 additions & 1 deletion packages/horizon/test/escrow/collector.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down