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