优化event到scription的转化
This commit is contained in:
parent
d9aca9e482
commit
eee4ee213d
@ -5,7 +5,7 @@
|
||||
"address": "0x0Fd13D2CD0B6c679B6f92590E0b91C18DDe7BD3A",
|
||||
"event": "ActionEvent",
|
||||
"abi": "TreasureHunt",
|
||||
"fromBlock": 26202217,
|
||||
"fromBlock": 26211451,
|
||||
"eventProcesser": "TreasureHunt"
|
||||
}
|
||||
]
|
@ -4,7 +4,7 @@
|
||||
"address": "0x0Fd13D2CD0B6c679B6f92590E0b91C18DDe7BD3A",
|
||||
"event": "ActionEvent",
|
||||
"abi": "TreasureHunt",
|
||||
"fromBlock": 26202217,
|
||||
"fromBlock": 26211451,
|
||||
"eventProcesser": "TreasureHunt"
|
||||
}
|
||||
]
|
@ -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', '')
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user