From 4be7236b9bad391985a6b407965052075cd0248b Mon Sep 17 00:00:00 2001 From: Illia Malachyn Date: Thu, 8 Aug 2024 13:31:55 +0300 Subject: [PATCH] Add decoder for FlowFees.FeesDeducted event --- fvm/evm/events/events.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fvm/evm/events/events.go b/fvm/evm/events/events.go index b59f34bd41c..775b0d3adea 100644 --- a/fvm/evm/events/events.go +++ b/fvm/evm/events/events.go @@ -16,6 +16,7 @@ import ( const ( EventTypeBlockExecuted flow.EventType = "EVM.BlockExecuted" EventTypeTransactionExecuted flow.EventType = "EVM.TransactionExecuted" + EventTypeFlowFeesDeducted flow.EventType = "FlowFees.FeesDeducted" ) type EventPayload interface { @@ -214,3 +215,15 @@ func FlowEventToCadenceEvent(event flow.Event) (cadence.Event, error) { } return cadenceEvent, nil } + +type FlowFeesDeductedEventPayload struct { + Amount cadence.UFix64 `cadence:"amount"` + InclusionEffort cadence.UFix64 `cadence:"inclusionEffort"` + ExecutionEffort cadence.UFix64 `cadence:"executionEffort"` +} + +func DecodeFlowFeesDeductedEventPayload(event cadence.Event) (*FlowFeesDeductedEventPayload, error) { + var payload FlowFeesDeductedEventPayload + err := cadence.DecodeFields(event, &payload) + return &payload, err +}