From 2370c0fe5be98fd697235a8d7a17443c004514a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Fri, 4 Oct 2024 10:10:10 -0300 Subject: [PATCH] feat: add rav collected event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- .../contracts/interfaces/ITAPCollector.sol | 20 +++++++++++++++++++ .../payments/collectors/TAPCollector.sol | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/packages/horizon/contracts/interfaces/ITAPCollector.sol b/packages/horizon/contracts/interfaces/ITAPCollector.sol index 6cfc16485..72a8dc0bc 100644 --- a/packages/horizon/contracts/interfaces/ITAPCollector.sol +++ b/packages/horizon/contracts/interfaces/ITAPCollector.sol @@ -34,6 +34,26 @@ interface ITAPCollector is IPaymentsCollector { bytes signature; } + /** + * @notice Emitted when a RAV is collected + * @param payer The address of the payer + * @param dataService The address of the data service + * @param serviceProvider The address of the service provider + * @param timestampNs The timestamp of the RAV + * @param valueAggregate The total amount owed to the service provider + * @param metadata Arbitrary metadata + * @param signature The signature of the RAV + */ + event RAVCollected( + address indexed payer, + address indexed dataService, + address indexed serviceProvider, + uint64 timestampNs, + uint128 valueAggregate, + bytes metadata, + bytes signature + ); + /** * Thrown when the caller is not the data service the RAV was issued to * @param caller The address of the caller diff --git a/packages/horizon/contracts/payments/collectors/TAPCollector.sol b/packages/horizon/contracts/payments/collectors/TAPCollector.sol index f9b228ead..91293af09 100644 --- a/packages/horizon/contracts/payments/collectors/TAPCollector.sol +++ b/packages/horizon/contracts/payments/collectors/TAPCollector.sol @@ -85,6 +85,15 @@ contract TAPCollector is EIP712, GraphDirectory, ITAPCollector { } emit PaymentCollected(paymentType, payer, receiver, tokensToCollect, dataService, tokensDataService); + emit RAVCollected( + payer, + dataService, + receiver, + signedRAV.rav.timestampNs, + signedRAV.rav.valueAggregate, + signedRAV.rav.metadata, + signedRAV.signature + ); return tokensToCollect; }