core: store MinimumDeploymentFee as uint32

This commit is contained in:
Anna Shaleva 2020-12-22 16:09:16 +03:00
parent df6cb11017
commit e40f3610ed

View file

@ -357,11 +357,11 @@ func (m *Management) getMinimumDeploymentFee(ic *interop.Context, args []stackit
// GetMinimumDeploymentFee returns the minimum required fee for contract deploy.
func (m *Management) GetMinimumDeploymentFee(dao dao.DAO) int64 {
return getInt64WithKey(m.ContractID, dao, keyMinimumDeploymentFee, defaultMinimumDeploymentFee)
return int64(getUint32WithKey(m.ContractID, dao, keyMinimumDeploymentFee, defaultMinimumDeploymentFee))
}
func (m *Management) setMinimumDeploymentFee(ic *interop.Context, args []stackitem.Item) stackitem.Item {
value := toBigInt(args[0]).Int64()
value := toUint32(args[0])
if value < 0 {
panic(fmt.Errorf("MinimumDeploymentFee cannot be negative"))
}
@ -372,7 +372,7 @@ func (m *Management) setMinimumDeploymentFee(ic *interop.Context, args []stackit
if !ok {
return stackitem.NewBool(false)
}
err = setInt64WithKey(m.ContractID, ic.DAO, keyMinimumDeploymentFee, value)
err = setUint32WithKey(m.ContractID, ic.DAO, keyMinimumDeploymentFee, value)
if err != nil {
panic(err)
}
@ -483,7 +483,7 @@ func (m *Management) PostPersist(ic *interop.Context) error {
// Initialize implements Contract interface.
func (m *Management) Initialize(ic *interop.Context) error {
return setInt64WithKey(m.ContractID, ic.DAO, keyMinimumDeploymentFee, defaultMinimumDeploymentFee)
return setUint32WithKey(m.ContractID, ic.DAO, keyMinimumDeploymentFee, defaultMinimumDeploymentFee)
}
// PutContractState saves given contract state into given DAO.