This commit is contained in:
aozhiwei 2024-09-03 15:30:26 +08:00
parent ad8e659440
commit 82ea4ac5f0

View File

@ -70,7 +70,7 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
ds.GetByName("idx"), ds.GetByName("idx"),
ds.GetByName("contract_name"), ds.GetByName("contract_name"),
ds.GetByName("event_name")) ds.GetByName("event_name"))
idx := ds.GetByName("idx") idx := q5.ToInt64(ds.GetByName("idx"))
txhash := ds.GetByName("txhash") txhash := ds.GetByName("txhash")
logIndex := ds.GetByName("log_index") logIndex := ds.GetByName("log_index")
netId := ds.GetByName("net_id") netId := ds.GetByName("net_id")
@ -99,7 +99,7 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
{"log_index", logIndex}, {"log_index", logIndex},
{"net_id", netId}, {"net_id", netId},
{"contract_address", strings.ToLower(contractAddress)}, {"contract_address", strings.ToLower(contractAddress)},
{"src_idx", idx}, {"src_idx", q5.ToString(idx)},
{"event_name", eventName}, {"event_name", eventName},
{"account_address", p.Account}, {"account_address", p.Account},
{"token_address", p.Token}, {"token_address", p.Token},
@ -111,9 +111,13 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
return false return false
} }
if eventName == EVENT_NAME_STAKE_CEC { if eventName == EVENT_NAME_STAKE_CEC {
this.applyStake(p) if !this.applyStake(idx, p) {
return false
}
} else if eventName == EVENT_NAME_UNSTAKE_CEC { } else if eventName == EVENT_NAME_UNSTAKE_CEC {
this.applyUnstake(p) if !this.applyUnstake(idx, p) {
return false
}
} else { } else {
return false return false
} }
@ -124,17 +128,17 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
"param1": txhash, "param1": txhash,
"param2": netId, "param2": netId,
"param3": eventName, "param3": eventName,
"param4": idx, "param4": q5.ToString(idx),
"param5": contractAddress, "param5": contractAddress,
}) })
} }
return true return true
} }
func (this *stackingCec) applyStake(p *jccommon.ContractStakeAndUnstakeCecPo) bool { func (this *stackingCec) applyStake(idx int64, p *jccommon.ContractStakeAndUnstakeCecPo) bool {
return true return true
} }
func (this *stackingCec) applyUnstake(p *jccommon.ContractStakeAndUnstakeCecPo) bool { func (this *stackingCec) applyUnstake(idx int64, p *jccommon.ContractStakeAndUnstakeCecPo) bool {
return true return true
} }