1
This commit is contained in:
parent
82ea4ac5f0
commit
8c1efd1baa
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user