native: fix minimum deployment fee setting
SA4003: no value of type uint32 is less than 0 (staticcheck) But it's more involved than that, we should allow any positive big.Int here.
This commit is contained in:
parent
d15cacc1ba
commit
b5ff87c2bd
1 changed files with 4 additions and 4 deletions
|
@ -409,14 +409,14 @@ func (m *Management) GetMinimumDeploymentFee(dao dao.DAO) int64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Management) setMinimumDeploymentFee(ic *interop.Context, args []stackitem.Item) stackitem.Item {
|
func (m *Management) setMinimumDeploymentFee(ic *interop.Context, args []stackitem.Item) stackitem.Item {
|
||||||
value := toUint32(args[0])
|
value := toBigInt(args[0])
|
||||||
if value < 0 {
|
if value.Sign() < 0 {
|
||||||
panic(fmt.Errorf("MinimumDeploymentFee cannot be negative"))
|
panic("MinimumDeploymentFee cannot be negative")
|
||||||
}
|
}
|
||||||
if !m.NEO.checkCommittee(ic) {
|
if !m.NEO.checkCommittee(ic) {
|
||||||
panic("invalid committee signature")
|
panic("invalid committee signature")
|
||||||
}
|
}
|
||||||
err := setIntWithKey(m.ID, ic.DAO, keyMinimumDeploymentFee, int64(value))
|
err := ic.DAO.PutStorageItem(m.ID, keyMinimumDeploymentFee, bigint.ToBytes(value))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue