From 31eca342ebdb49a73e65a0442042a0122623656b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 24 Nov 2020 11:14:25 +0300 Subject: [PATCH] *: replace all NEP5 occurences to NEP17 --- cli/candidate_test.go | 2 +- cli/multisig_test.go | 4 +- cli/{nep5_test.go => nep17_test.go} | 26 ++++---- cli/wallet/{nep5.go => nep17.go} | 48 +++++++------- cli/wallet/wallet.go | 8 +-- cli/wallet_test.go | 6 +- docs/rpc.md | 12 ++-- .../token/{nep5/nep5.go => nep17/nep17.go} | 2 +- examples/token/token.go | 6 +- pkg/core/blockchain.go | 36 +++++----- pkg/core/blockchain_test.go | 2 +- pkg/core/blockchainer/blockchainer.go | 4 +- pkg/core/dao/cacheddao.go | 48 +++++++------- pkg/core/dao/dao.go | 64 +++++++++--------- pkg/core/helper_test.go | 14 ++-- pkg/core/native/native_gas.go | 2 +- pkg/core/native/native_nep17.go | 2 +- pkg/core/native_neo_test.go | 2 +- pkg/core/state/native_state.go | 26 ++++---- pkg/core/state/{nep5.go => nep17.go} | 56 ++++++++-------- .../state/{nep5_test.go => nep17_test.go} | 24 +++---- pkg/core/storage/store.go | 4 +- pkg/network/helper_test.go | 4 +- pkg/rpc/client/doc.go | 4 +- pkg/rpc/client/doc_test.go | 2 +- pkg/rpc/client/{nep5.go => nep17.go} | 58 ++++++++-------- pkg/rpc/client/rpc.go | 16 ++--- pkg/rpc/client/rpc_test.go | 46 ++++++------- pkg/rpc/response/result/{nep5.go => nep17.go} | 26 ++++---- pkg/rpc/server/client_test.go | 16 ++--- pkg/rpc/server/server.go | 28 ++++---- pkg/rpc/server/server_test.go | 66 +++++++++---------- pkg/wallet/token_test.go | 6 +- 33 files changed, 335 insertions(+), 335 deletions(-) rename cli/{nep5_test.go => nep17_test.go} (91%) rename cli/wallet/{nep5.go => nep17.go} (91%) rename examples/token/{nep5/nep5.go => nep17/nep17.go} (99%) rename pkg/core/state/{nep5.go => nep17.go} (70%) rename pkg/core/state/{nep5_test.go => nep17_test.go} (68%) rename pkg/rpc/client/{nep5.go => nep17.go} (70%) rename pkg/rpc/response/result/{nep5.go => nep17.go} (52%) diff --git a/cli/candidate_test.go b/cli/candidate_test.go index 4358b992b..3018754d9 100644 --- a/cli/candidate_test.go +++ b/cli/candidate_test.go @@ -16,7 +16,7 @@ func TestRegisterCandidate(t *testing.T) { defer e.Close(t) e.In.WriteString("one\r") - e.Run(t, "neo-go", "wallet", "nep5", "multitransfer", + e.Run(t, "neo-go", "wallet", "nep17", "multitransfer", "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", validatorWallet, "--from", validatorAddr, diff --git a/cli/multisig_test.go b/cli/multisig_test.go index 9672537eb..d8aebfef5 100644 --- a/cli/multisig_test.go +++ b/cli/multisig_test.go @@ -51,7 +51,7 @@ func TestSignMultisigTx(t *testing.T) { // Transfer funds to the multisig. e.In.WriteString("one\r") - e.Run(t, "neo-go", "wallet", "nep5", "multitransfer", + e.Run(t, "neo-go", "wallet", "nep17", "multitransfer", "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", validatorWallet, "--from", validatorAddr, @@ -66,7 +66,7 @@ func TestSignMultisigTx(t *testing.T) { txPath := path.Join(tmpDir, "multisigtx.json") defer os.Remove(txPath) e.In.WriteString("pass\r") - e.Run(t, "neo-go", "wallet", "nep5", "transfer", + e.Run(t, "neo-go", "wallet", "nep17", "transfer", "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", wallet1Path, "--from", multisigAddr, "--to", priv.Address(), "--token", "neo", "--amount", "1", diff --git a/cli/nep5_test.go b/cli/nep17_test.go similarity index 91% rename from cli/nep5_test.go rename to cli/nep17_test.go index cf6b2f4a1..78ecb478c 100644 --- a/cli/nep5_test.go +++ b/cli/nep17_test.go @@ -15,10 +15,10 @@ import ( "github.com/stretchr/testify/require" ) -func TestNEP5Balance(t *testing.T) { +func TestNEP17Balance(t *testing.T) { e := newExecutor(t, true) defer e.Close(t) - cmdbalance := []string{"neo-go", "wallet", "nep5", "balance"} + cmdbalance := []string{"neo-go", "wallet", "nep17", "balance"} cmdbase := append(cmdbalance, "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", validatorWallet, @@ -99,7 +99,7 @@ func TestNEP5Balance(t *testing.T) { return } -func TestNEP5Transfer(t *testing.T) { +func TestNEP17Transfer(t *testing.T) { w, err := wallet.NewWalletFromFile("testdata/testwallet.json") require.NoError(t, err) defer w.Close() @@ -107,7 +107,7 @@ func TestNEP5Transfer(t *testing.T) { e := newExecutor(t, true) defer e.Close(t) args := []string{ - "neo-go", "wallet", "nep5", "transfer", + "neo-go", "wallet", "nep17", "transfer", "--rpc-endpoint", "http://" + e.RPC.Addr, "--wallet", validatorWallet, "--from", validatorAddr, @@ -132,7 +132,7 @@ func TestNEP5Transfer(t *testing.T) { require.Equal(t, big.NewInt(1), b) } -func TestNEP5MultiTransfer(t *testing.T) { +func TestNEP17MultiTransfer(t *testing.T) { privs, _ := generateKeys(t, 3) e := newExecutor(t, true) @@ -140,7 +140,7 @@ func TestNEP5MultiTransfer(t *testing.T) { neoContractHash, err := e.Chain.GetNativeContractScriptHash("neo") require.NoError(t, err) args := []string{ - "neo-go", "wallet", "nep5", "multitransfer", + "neo-go", "wallet", "nep17", "multitransfer", "--rpc-endpoint", "http://" + e.RPC.Addr, "--wallet", validatorWallet, "--from", validatorAddr, @@ -161,7 +161,7 @@ func TestNEP5MultiTransfer(t *testing.T) { require.Equal(t, big.NewInt(13), b) } -func TestNEP5ImportToken(t *testing.T) { +func TestNEP17ImportToken(t *testing.T) { e := newExecutor(t, true) defer e.Close(t) @@ -174,11 +174,11 @@ func TestNEP5ImportToken(t *testing.T) { gasContractHash, err := e.Chain.GetNativeContractScriptHash("gas") require.NoError(t, err) e.Run(t, "neo-go", "wallet", "init", "--wallet", walletPath) - e.Run(t, "neo-go", "wallet", "nep5", "import", + e.Run(t, "neo-go", "wallet", "nep17", "import", "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", walletPath, "--token", gasContractHash.StringLE()) - e.Run(t, "neo-go", "wallet", "nep5", "import", + e.Run(t, "neo-go", "wallet", "nep17", "import", "--rpc-endpoint", "http://"+e.RPC.Addr, "--wallet", walletPath, "--token", neoContractHash.StringLE()) @@ -192,12 +192,12 @@ func TestNEP5ImportToken(t *testing.T) { e.checkNextLine(t, "^Address:\\s*"+address.Uint160ToString(gasContractHash)) } t.Run("WithToken", func(t *testing.T) { - e.Run(t, "neo-go", "wallet", "nep5", "info", + e.Run(t, "neo-go", "wallet", "nep17", "info", "--wallet", walletPath, "--token", gasContractHash.StringLE()) checkGASInfo(t) }) t.Run("NoToken", func(t *testing.T) { - e.Run(t, "neo-go", "wallet", "nep5", "info", + e.Run(t, "neo-go", "wallet", "nep17", "info", "--wallet", walletPath) checkGASInfo(t) _, err := e.Out.ReadString('\n') @@ -210,9 +210,9 @@ func TestNEP5ImportToken(t *testing.T) { }) t.Run("Remove", func(t *testing.T) { e.In.WriteString("y\r") - e.Run(t, "neo-go", "wallet", "nep5", "remove", + e.Run(t, "neo-go", "wallet", "nep17", "remove", "--wallet", walletPath, "--token", neoContractHash.StringLE()) - e.Run(t, "neo-go", "wallet", "nep5", "info", + e.Run(t, "neo-go", "wallet", "nep17", "info", "--wallet", walletPath) checkGASInfo(t) _, err := e.Out.ReadString('\n') diff --git a/cli/wallet/nep5.go b/cli/wallet/nep17.go similarity index 91% rename from cli/wallet/nep5.go rename to cli/wallet/nep17.go index 35f228712..27eab4ee5 100644 --- a/cli/wallet/nep5.go +++ b/cli/wallet/nep17.go @@ -26,7 +26,7 @@ var ( } ) -func newNEP5Commands() []cli.Command { +func newNEP17Commands() []cli.Command { balanceFlags := []cli.Flag{ walletPathFlag, tokenFlag, @@ -69,21 +69,21 @@ func newNEP5Commands() []cli.Command { Name: "balance", Usage: "get address balance", UsageText: "balance --wallet --rpc-endpoint [--timeout