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 c1829ec9f..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", @@ -93,7 +93,7 @@ func TestSignMultisigTx(t *testing.T) { e.Chain.GoverningTokenHash().StringLE(), "transfer", "bytes:"+multisigHash.StringBE(), "bytes:"+priv.GetScriptHash().StringBE(), - "int:1", + "int:1", "bytes:", "--", strings.Join([]string{multisigHash.StringLE(), ":", "Global"}, "")) e.In.WriteString("pass\r") 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/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index a311f0993..4b92ca465 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -349,6 +349,7 @@ func initSmartContract(ctx *cli.Context) error { } m := ProjectConfig{ + Name: contractName, SupportedStandards: []string{}, Events: []manifest.Event{ { @@ -404,6 +405,7 @@ func contractCompile(ctx *cli.Context) error { if err != nil { return err } + o.Name = conf.Name o.ContractEvents = conf.Events o.ContractSupportedStandards = conf.SupportedStandards } @@ -631,6 +633,7 @@ func testInvokeScript(ctx *cli.Context) error { // ProjectConfig contains project metadata. type ProjectConfig struct { + Name string SupportedStandards []string Events []manifest.Event } diff --git a/cli/smartcontract/smart_contract_test.go b/cli/smartcontract/smart_contract_test.go index b8c019b73..8264cb858 100644 --- a/cli/smartcontract/smart_contract_test.go +++ b/cli/smartcontract/smart_contract_test.go @@ -58,7 +58,8 @@ func RuntimeNotify(args []interface{}) { manifest, err := ioutil.ReadFile(contractName + "/" + files[1].Name()) require.NoError(t, err) require.Equal(t, - `supportedstandards: [] + `name: testContract +supportedstandards: [] events: - name: Hello world! parameters: diff --git a/cli/testdata/verify.go b/cli/testdata/verify.go index 467e1fd59..6a3ed7b6a 100644 --- a/cli/testdata/verify.go +++ b/cli/testdata/verify.go @@ -3,3 +3,6 @@ package testdata func Verify() bool { return true } + +func OnPayment(from []byte, amount int, data interface{}) { +} diff --git a/cli/testdata/verify.manifest.json b/cli/testdata/verify.manifest.json index 910fce3b8..518bcd896 100755 --- a/cli/testdata/verify.manifest.json +++ b/cli/testdata/verify.manifest.json @@ -1 +1 @@ -{"abi":{"hash":"0x8dff9f223e4622961f410c015dd37052a59892bb","methods":[{"name":"verify","offset":0,"parameters":[],"returntype":"Boolean"}],"events":[]},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"safemethods":[],"extra":null} +{"name":"verify","abi":{"hash":"0xbf214a7551e50d6fbe0bef05271719325d9fc1ef","methods":[{"name":"verify","offset":0,"parameters":[],"returntype":"Boolean"},{"name":"onPayment","offset":5,"parameters":[{"name":"from","type":"ByteArray"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void"}],"events":[]},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"safemethods":[],"extra":null} \ No newline at end of file diff --git a/cli/testdata/verify.nef b/cli/testdata/verify.nef index 65f2011fb..309796612 100755 Binary files a/cli/testdata/verify.nef and b/cli/testdata/verify.nef differ 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