Fix legacy AffirmationCompleted
This commit is contained in:
parent
397ce2fd43
commit
c35318ef57
|
@ -877,6 +877,33 @@
|
||||||
"name": "AffirmationCompleted",
|
"name": "AffirmationCompleted",
|
||||||
"type": "event"
|
"type": "event"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"anonymous": false,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"name": "sender",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"name": "executor",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"name": "messageId",
|
||||||
|
"type": "bytes32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"name": "status",
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "AffirmationCompleted",
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"anonymous": false,
|
"anonymous": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
|
|
|
@ -54,13 +54,13 @@ func (c *Contract) ParseLog(log *entity.Log) (string, map[string]interface{}, er
|
||||||
return "", nil, nil
|
return "", nil, nil
|
||||||
}
|
}
|
||||||
m := make(map[string]interface{})
|
m := make(map[string]interface{})
|
||||||
err := event.Inputs.UnpackIntoMap(m, log.Data)
|
if len(indexed) < len(event.Inputs) {
|
||||||
if err != nil {
|
if err := event.Inputs.UnpackIntoMap(m, log.Data); err != nil {
|
||||||
return "", nil, err
|
return "", nil, fmt.Errorf("can't unpack data: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err = abi.ParseTopicsIntoMap(m, indexed, topics)
|
if err := abi.ParseTopicsIntoMap(m, indexed, topics); err != nil {
|
||||||
if err != nil {
|
return "", nil, fmt.Errorf("can't unpack topics: %w", err)
|
||||||
return "", nil, err
|
|
||||||
}
|
}
|
||||||
return event.Name, m, nil
|
return event.Name, m, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ func newContractMonitor(ctx context.Context, logger logging.Logger, repo *reposi
|
||||||
blocksRangeChan: make(chan *BlocksRange, 10),
|
blocksRangeChan: make(chan *BlocksRange, 10),
|
||||||
logsChan: make(chan *LogsBatch, 200),
|
logsChan: make(chan *LogsBatch, 200),
|
||||||
contract: contract.NewContract(client, cfg.Address, constants.AMB),
|
contract: contract.NewContract(client, cfg.Address, constants.AMB),
|
||||||
eventHandlers: make(map[string]EventHandler, 6),
|
eventHandlers: make(map[string]EventHandler, 7),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ func NewMonitor(ctx context.Context, logger logging.Logger, repo *repository.Rep
|
||||||
homeMonitor.eventHandlers["SignedForUserRequest"] = handlers.HandleSignedForUserRequest
|
homeMonitor.eventHandlers["SignedForUserRequest"] = handlers.HandleSignedForUserRequest
|
||||||
homeMonitor.eventHandlers["SignedForAffirmation"] = handlers.HandleSignedForAffirmation
|
homeMonitor.eventHandlers["SignedForAffirmation"] = handlers.HandleSignedForAffirmation
|
||||||
homeMonitor.eventHandlers["AffirmationCompleted"] = handlers.HandleAffirmationCompleted
|
homeMonitor.eventHandlers["AffirmationCompleted"] = handlers.HandleAffirmationCompleted
|
||||||
|
homeMonitor.eventHandlers["AffirmationCompleted0"] = handlers.HandleAffirmationCompleted
|
||||||
homeMonitor.eventHandlers["CollectedSignatures"] = handlers.HandleCollectedSignatures
|
homeMonitor.eventHandlers["CollectedSignatures"] = handlers.HandleCollectedSignatures
|
||||||
foreignMonitor.eventHandlers["UserRequestForAffirmation"] = handlers.HandleUserRequestForAffirmation
|
foreignMonitor.eventHandlers["UserRequestForAffirmation"] = handlers.HandleUserRequestForAffirmation
|
||||||
foreignMonitor.eventHandlers["UserRequestForAffirmation0"] = handlers.HandleLegacyUserRequestForAffirmation
|
foreignMonitor.eventHandlers["UserRequestForAffirmation0"] = handlers.HandleLegacyUserRequestForAffirmation
|
||||||
|
@ -376,7 +377,7 @@ func (m *ContractMonitor) tryToProcessLogsBatch(ctx context.Context, logs *LogsB
|
||||||
for _, log := range logs.Logs {
|
for _, log := range logs.Logs {
|
||||||
event, data, err := m.contract.ParseLog(log)
|
event, data, err := m.contract.ParseLog(log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("can't parse log: %w", err)
|
||||||
}
|
}
|
||||||
handle, ok := m.eventHandlers[event]
|
handle, ok := m.eventHandlers[event]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue