mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
*: use nativehashes package where possible
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
2d3d52e3d0
commit
ec6fc54bc6
10 changed files with 20 additions and 23 deletions
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/dao"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
|
@ -610,7 +610,7 @@ func TestCallWithVersion(t *testing.T) {
|
|||
e.DeployContract(t, ctr, nil)
|
||||
c := e.CommitteeInvoker(ctr.Hash)
|
||||
|
||||
policyH := state.CreateNativeContractHash(nativenames.Policy)
|
||||
policyH := nativehashes.Policy
|
||||
t.Run("good", func(t *testing.T) {
|
||||
c.Invoke(t, e.Chain.GetBaseExecFee(), "callWithVersion", policyH.BytesBE(), 0, "getExecFeeFactor")
|
||||
})
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/interop/interopnames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/mempool"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativeprices"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
|
||||
|
@ -2460,7 +2461,7 @@ func TestBlockchain_GenesisTransactionExtension(t *testing.T) {
|
|||
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
|
||||
emit.Bytes(script.BinWriter, to.BytesBE())
|
||||
emit.Syscall(script.BinWriter, interopnames.SystemRuntimeCheckWitness)
|
||||
emit.AppCall(script.BinWriter, state.CreateNativeContractHash(nativenames.Neo), "transfer", callflag.All, from, to, amount, nil)
|
||||
emit.AppCall(script.BinWriter, nativehashes.Neo, "transfer", callflag.All, from, to, amount, nil)
|
||||
emit.Opcodes(script.BinWriter, opcode.ASSERT)
|
||||
|
||||
var sysFee int64 = 1_0000_0000
|
||||
|
|
|
@ -8,13 +8,12 @@ package for more details on NEP-17 interface.
|
|||
package gas
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nep17"
|
||||
)
|
||||
|
||||
// Hash stores the hash of the native GAS contract.
|
||||
var Hash = state.CreateNativeContractHash(nativenames.Gas)
|
||||
var Hash = nativehashes.Gas
|
||||
|
||||
// NewReader creates a NEP-17 reader for the GAS contract.
|
||||
func NewReader(invoker nep17.Invoker) *nep17.TokenReader {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"math/big"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
||||
|
@ -75,7 +75,7 @@ type HashesIterator struct {
|
|||
}
|
||||
|
||||
// Hash stores the hash of the native ContractManagement contract.
|
||||
var Hash = state.CreateNativeContractHash(nativenames.Management)
|
||||
var Hash = nativehashes.Management
|
||||
|
||||
// Event is the event emitted on contract deployment/update/destroy.
|
||||
// Even though these events are different they all have the same field inside.
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"math/big"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
|
@ -97,7 +97,7 @@ type ValidatorIterator struct {
|
|||
}
|
||||
|
||||
// Hash stores the hash of the native NEOToken contract.
|
||||
var Hash = state.CreateNativeContractHash(nativenames.Neo)
|
||||
var Hash = nativehashes.Neo
|
||||
|
||||
// NewReader creates an instance of ContractReader to get data from the NEO
|
||||
// contract.
|
||||
|
|
|
@ -13,8 +13,7 @@ import (
|
|||
"math"
|
||||
"math/big"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap"
|
||||
|
@ -76,7 +75,7 @@ type OnNEP17PaymentData struct {
|
|||
var _ = stackitem.Convertible(&OnNEP17PaymentData{})
|
||||
|
||||
// Hash stores the hash of the native Notary contract.
|
||||
var Hash = state.CreateNativeContractHash(nativenames.Notary)
|
||||
var Hash = nativehashes.Notary
|
||||
|
||||
// NewReader creates an instance of ContractReader to get data from the Notary
|
||||
// contract.
|
||||
|
|
|
@ -9,8 +9,7 @@ package oracle
|
|||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap"
|
||||
|
@ -32,7 +31,7 @@ type Actor interface {
|
|||
}
|
||||
|
||||
// Hash stores the hash of the native OracleContract contract.
|
||||
var Hash = state.CreateNativeContractHash(nativenames.Oracle)
|
||||
var Hash = nativehashes.Oracle
|
||||
|
||||
const priceSetter = "setPrice"
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ various methods to perform PolicyContract state-changing calls.
|
|||
package policy
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap"
|
||||
|
@ -34,7 +33,7 @@ type Actor interface {
|
|||
}
|
||||
|
||||
// Hash stores the hash of the native PolicyContract contract.
|
||||
var Hash = state.CreateNativeContractHash(nativenames.Policy)
|
||||
var Hash = nativehashes.Policy
|
||||
|
||||
const (
|
||||
execFeeSetter = "setExecFeeFactor"
|
||||
|
|
|
@ -7,9 +7,8 @@ various methods to perform the only RoleManagement state-changing call.
|
|||
package rolemgmt
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
||||
|
@ -32,7 +31,7 @@ type Actor interface {
|
|||
}
|
||||
|
||||
// Hash stores the hash of the native RoleManagement contract.
|
||||
var Hash = state.CreateNativeContractHash(nativenames.Designation)
|
||||
var Hash = nativehashes.Designation
|
||||
|
||||
const designateMethod = "designateAsRole"
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/fee"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativehashes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
|
@ -825,7 +826,7 @@ func TestCalculateNetworkFee(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// Set fee per Conflicts attribute.
|
||||
script, err := smartcontract.CreateCallScript(state.CreateNativeContractHash(nativenames.Policy), "setAttributeFee", byte(transaction.ConflictsT), conflictsFee)
|
||||
script, err := smartcontract.CreateCallScript(nativehashes.Policy, "setAttributeFee", byte(transaction.ConflictsT), conflictsFee)
|
||||
require.NoError(t, err)
|
||||
txSetFee := transaction.New(script, 1_0000_0000)
|
||||
txSetFee.ValidUntilBlock = chain.BlockHeight() + 1
|
||||
|
|
Loading…
Reference in a new issue