This commit is contained in:
aozhiwei 2024-09-24 10:47:08 +08:00
parent 7a9714801b
commit 9982b8bc9a

View File

@ -95,12 +95,22 @@ func (this *vip) RecalcEsCecConvert(accountAddress string) error {
if err != nil {
return err
}
var lastWithdraw *vesterDepositWithdrawPo
allDeposits := []*vesterDepositWithdrawPo{}
for ds.Next() {
eventName := ds.GetByName("event_name")
if eventName == constant.VESTER_DEPOSIT_EVENT_NAME {
} else if eventName == constant.VESTER_WITHDRAW_EVENT_NAME {
p := new(vesterDepositWithdrawPo)
p.eventName = ds.GetByName("event_name")
p.chainTimestamp = q5.ToInt32(ds.GetByName("chain_timestamp"))
p.accountAddress = ds.GetByName("account_address")
p.depositAmount = ds.GetByName("deposit_amount")
p.withdrawClamiedAmount = ds.GetByName("withdraw_clamied_amount")
p.withdrawBalance = ds.GetByName("withdraw_balance")
if p.eventName == constant.VESTER_DEPOSIT_EVENT_NAME {
q5.AppendSlice(&allDeposits, p)
} else if p.eventName == constant.VESTER_WITHDRAW_EVENT_NAME {
if lastWithdraw == nil || lastWithdraw.chainTimestamp < p.chainTimestamp {
lastWithdraw = p
}
}
}
return nil