1
This commit is contained in:
parent
9982b8bc9a
commit
9775c0da00
@ -95,23 +95,34 @@ func (this *vip) RecalcEsCecConvert(accountAddress string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var lastWithdraw *vesterDepositWithdrawPo
|
matchDeposits := []*vesterDepositWithdrawPo{}
|
||||||
allDeposits := []*vesterDepositWithdrawPo{}
|
{
|
||||||
for ds.Next() {
|
var lastWithdraw *vesterDepositWithdrawPo
|
||||||
p := new(vesterDepositWithdrawPo)
|
allDeposits := []*vesterDepositWithdrawPo{}
|
||||||
p.eventName = ds.GetByName("event_name")
|
for ds.Next() {
|
||||||
p.chainTimestamp = q5.ToInt32(ds.GetByName("chain_timestamp"))
|
p := new(vesterDepositWithdrawPo)
|
||||||
p.accountAddress = ds.GetByName("account_address")
|
p.eventName = ds.GetByName("event_name")
|
||||||
p.depositAmount = ds.GetByName("deposit_amount")
|
p.chainTimestamp = q5.ToInt32(ds.GetByName("chain_timestamp"))
|
||||||
p.withdrawClamiedAmount = ds.GetByName("withdraw_clamied_amount")
|
p.accountAddress = ds.GetByName("account_address")
|
||||||
p.withdrawBalance = ds.GetByName("withdraw_balance")
|
p.depositAmount = ds.GetByName("deposit_amount")
|
||||||
if p.eventName == constant.VESTER_DEPOSIT_EVENT_NAME {
|
p.withdrawClamiedAmount = ds.GetByName("withdraw_clamied_amount")
|
||||||
q5.AppendSlice(&allDeposits, p)
|
p.withdrawBalance = ds.GetByName("withdraw_balance")
|
||||||
} else if p.eventName == constant.VESTER_WITHDRAW_EVENT_NAME {
|
if p.eventName == constant.VESTER_DEPOSIT_EVENT_NAME {
|
||||||
if lastWithdraw == nil || lastWithdraw.chainTimestamp < p.chainTimestamp {
|
q5.AppendSlice(&allDeposits, p)
|
||||||
lastWithdraw = p
|
} else if p.eventName == constant.VESTER_WITHDRAW_EVENT_NAME {
|
||||||
|
if lastWithdraw == nil || lastWithdraw.chainTimestamp < p.chainTimestamp {
|
||||||
|
lastWithdraw = p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, val := range allDeposits {
|
||||||
|
if lastWithdraw == nil || val.chainTimestamp > lastWithdraw.chainTimestamp {
|
||||||
|
q5.AppendSlice(&matchDeposits, val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
q5.Sort(matchDeposits, func (a *vesterDepositWithdrawPo, b *vesterDepositWithdrawPo) bool {
|
||||||
|
return a.chainTimestamp < b.chainTimestamp
|
||||||
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user