diff --git a/config/event_list.json b/config/event_list.json index 7b046f8..09f8071 100644 --- a/config/event_list.json +++ b/config/event_list.json @@ -5,7 +5,7 @@ "address": "0x0Fd13D2CD0B6c679B6f92590E0b91C18DDe7BD3A", "event": "ActionEvent", "abi": "TreasureHunt", - "fromBlock": 26202217, + "fromBlock": 26211451, "eventProcesser": "TreasureHunt" } ] \ No newline at end of file diff --git a/config/event_list_production.json b/config/event_list_production.json index d32d936..ba8c3e1 100644 --- a/config/event_list_production.json +++ b/config/event_list_production.json @@ -4,7 +4,7 @@ "address": "0x0Fd13D2CD0B6c679B6f92590E0b91C18DDe7BD3A", "event": "ActionEvent", "abi": "TreasureHunt", - "fromBlock": 26202217, + "fromBlock": 26211451, "eventProcesser": "TreasureHunt" } ] \ No newline at end of file diff --git a/src/models/TreasureHunt.ts b/src/models/TreasureHunt.ts index 3509625..405be5a 100644 --- a/src/models/TreasureHunt.ts +++ b/src/models/TreasureHunt.ts @@ -27,7 +27,7 @@ const inputs = { '5': 'data:,{"p":"cf-20","op":"task_claim","val":"${val}"}' } export class TreasureHunt { - public static async saveEvent(event: any) { + public static async parseEvent(event: any) { const hash = event.hash || event.transactionHash let {user, action, value} = event.decodedData @@ -45,7 +45,7 @@ export class TreasureHunt { if (action === '2' || action === '5') { let val = Web3.utils.numberToHex(value).replace('0x', '') // convert value from hex to base64 - value = Buffer.from(value.slice(2), 'hex').toString('base64') + val = Buffer.from(val, 'hex').toString() eventScription.input = inputs[action].replace('${val}', val) } else if (action === '3' || action === '4') { let val = Web3.utils.numberToHex(value).replace('0x', '') diff --git a/src/service/event.batch.service.ts b/src/service/event.batch.service.ts index 644d120..6db3707 100644 --- a/src/service/event.batch.service.ts +++ b/src/service/event.batch.service.ts @@ -11,11 +11,13 @@ import { NftStake } from 'models/NftStake' import { IEventCfg } from 'interface/IEventCfg' import { ZRedisClient } from 'zutils' import { formatDate } from 'utils/utcdate.util' +import { TreasureHunt } from 'models/TreasureHunt' let eventProcessers = { NftHolder: NftHolder, TokenHolder: TokenHolder, NftStake: NftStake, + TreasureHunt: TreasureHunt, } const INTERVAL = 100