This commit is contained in:
aozhiwei 2024-09-03 15:50:40 +08:00
parent 82ea4ac5f0
commit 8c1efd1baa

View File

@ -8,6 +8,7 @@ import (
"jccommon" "jccommon"
"fmt" "fmt"
"strings" "strings"
"math/big"
) )
const ( const (
@ -110,15 +111,7 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
if dbErr != nil { if dbErr != nil {
return false return false
} }
if eventName == EVENT_NAME_STAKE_CEC { if !this.apply(idx, eventName, p) {
if !this.applyStake(idx, p) {
return false
}
} else if eventName == EVENT_NAME_UNSTAKE_CEC {
if !this.applyUnstake(idx, p) {
return false
}
} else {
return false return false
} }
} }
@ -135,10 +128,17 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
return true return true
} }
func (this *stackingCec) applyStake(idx int64, p *jccommon.ContractStakeAndUnstakeCecPo) bool { func (this *stackingCec) apply(idx int64, eventName string,
return true p *jccommon.ContractStakeAndUnstakeCecPo) bool {
} bnAmount, ok := new(big.Int).SetString(p.Amount, 10)
if !ok {
func (this *stackingCec) applyUnstake(idx int64, p *jccommon.ContractStakeAndUnstakeCecPo) bool { return false
}
if eventName == EVENT_NAME_STAKE_CEC {
} else if eventName == EVENT_NAME_UNSTAKE_CEC {
bnAmount = big.NewInt(0).Sub(big.NewInt(0), bnAmount)
} else {
return false
}
return true return true
} }