From e40f3610ed0f853e80410acc354dd4193ff16caf Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 22 Dec 2020 16:09:16 +0300 Subject: [PATCH] core: store MinimumDeploymentFee as uint32 --- pkg/core/native/management.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/core/native/management.go b/pkg/core/native/management.go index b28357537..ef5a5361c 100644 --- a/pkg/core/native/management.go +++ b/pkg/core/native/management.go @@ -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.