*: use NEP-XX naming consistently in docs/comments
Standards are NEP-11 and NEP-17, not NEP11, not NEP17, not anything else. Variable/function names of course can use whatever fits, but documents and comments should be consistent wrt this.
This commit is contained in:
parent
1375918b63
commit
ce9d0b22cf
23 changed files with 87 additions and 87 deletions
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -294,7 +294,7 @@ Improvements:
|
||||||
StateRootInHeader option (#2028)
|
StateRootInHeader option (#2028)
|
||||||
* cached GAS per vote value leads to substantially improved block processing
|
* cached GAS per vote value leads to substantially improved block processing
|
||||||
speed (#2032)
|
speed (#2032)
|
||||||
* failed native NEP17 transfers now still re-save the old value to the
|
* failed native NEP-17 transfers now still re-save the old value to the
|
||||||
storage making state dumps compatible with C# (#2034)
|
storage making state dumps compatible with C# (#2034)
|
||||||
* refactored and renamed some stackitem package functions, added proper error
|
* refactored and renamed some stackitem package functions, added proper error
|
||||||
values in all cases (#2045)
|
values in all cases (#2045)
|
||||||
|
@ -412,30 +412,30 @@ Bugs fixed:
|
||||||
## 0.95.0 "Sharpness" (17 May 2021)
|
## 0.95.0 "Sharpness" (17 May 2021)
|
||||||
|
|
||||||
This version mostly implements N3 RC2 protocol changes (and is fully
|
This version mostly implements N3 RC2 protocol changes (and is fully
|
||||||
RC2-compatible), but also brings NEP11 CLI support and small improvements for
|
RC2-compatible), but also brings NEP-11 CLI support and small improvements for
|
||||||
node operators.
|
node operators.
|
||||||
|
|
||||||
Please note that this release is incompatible with 0.94.1 and there won't be
|
Please note that this release is incompatible with 0.94.1 and there won't be
|
||||||
long-term support provided for it.
|
long-term support provided for it.
|
||||||
|
|
||||||
New features:
|
New features:
|
||||||
* CLI command for NEP17 transfers now accepts `data` parameter for the
|
* CLI command for NEP-17 transfers now accepts `data` parameter for the
|
||||||
transfer (#1906)
|
transfer (#1906)
|
||||||
* contract deployment CLI comand now also accepts `data` parameter for
|
* contract deployment CLI comand now also accepts `data` parameter for
|
||||||
`_deploy` method (#1907)
|
`_deploy` method (#1907)
|
||||||
* NEP11 and NEP17 transfers from CLI can now have multiple signers (#1914)
|
* NEP-11 and NEP-17 transfers from CLI can now have multiple signers (#1914)
|
||||||
* `System.Runtime.BurnGas` interop was added to burn some GAS as well as
|
* `System.Runtime.BurnGas` interop was added to burn some GAS as well as
|
||||||
`refuel` GAS contract method to add GAS to current execution environment
|
`refuel` GAS contract method to add GAS to current execution environment
|
||||||
(#1937)
|
(#1937)
|
||||||
* port number announced via P2P can now differ from actual port node is bound
|
* port number announced via P2P can now differ from actual port node is bound
|
||||||
to if new option is used (#1942)
|
to if new option is used (#1942)
|
||||||
* CLI now supports full set of NEP11 commands, including balance and
|
* CLI now supports full set of NEP-11 commands, including balance and
|
||||||
transfers (#1918)
|
transfers (#1918)
|
||||||
* string split, memory search and compare functions added to stdlib (#1943)
|
* string split, memory search and compare functions added to stdlib (#1943)
|
||||||
* MaxValidUntilBlockIncrement can now be configured (#1963)
|
* MaxValidUntilBlockIncrement can now be configured (#1963)
|
||||||
|
|
||||||
Behavior changes:
|
Behavior changes:
|
||||||
* `data` parameter is now passed in a different way to NEP17 RPC client
|
* `data` parameter is now passed in a different way to NEP-17 RPC client
|
||||||
methods (#1906)
|
methods (#1906)
|
||||||
* default (used if nothing else specified) signer scope is now
|
* default (used if nothing else specified) signer scope is now
|
||||||
`CalledByEntry` in CLI and RPC (#1909)
|
`CalledByEntry` in CLI and RPC (#1909)
|
||||||
|
@ -454,7 +454,7 @@ Behavior changes:
|
||||||
* node will reread TLS certificates (if any configured) on SIGHUP (#1945)
|
* node will reread TLS certificates (if any configured) on SIGHUP (#1945)
|
||||||
* contract trusts are now expressed with permission descriptors in manifest
|
* contract trusts are now expressed with permission descriptors in manifest
|
||||||
(#1946)
|
(#1946)
|
||||||
* NEP11 transfers now also support `data` parameter (#1950)
|
* NEP-11 transfers now also support `data` parameter (#1950)
|
||||||
* N3 RC2 testnet magic differs from N2 RC1 testnet (#1951, #1954)
|
* N3 RC2 testnet magic differs from N2 RC1 testnet (#1951, #1954)
|
||||||
* stdlib encoding/decoding methods now only accept inputs no longer than 1024
|
* stdlib encoding/decoding methods now only accept inputs no longer than 1024
|
||||||
bytes (#1943)
|
bytes (#1943)
|
||||||
|
@ -485,7 +485,7 @@ Improvements:
|
||||||
Bugs fixed:
|
Bugs fixed:
|
||||||
* `getproof` RPC request returned successful results in some cases where it
|
* `getproof` RPC request returned successful results in some cases where it
|
||||||
should fail
|
should fail
|
||||||
* `Transfer` events with invalid numbers were not rejected by NEP17 tracking
|
* `Transfer` events with invalid numbers were not rejected by NEP-17 tracking
|
||||||
code (#1902)
|
code (#1902)
|
||||||
* boolean function parameters were not accepted by `invokefunction` RPC call
|
* boolean function parameters were not accepted by `invokefunction` RPC call
|
||||||
implementation (#1920)
|
implementation (#1920)
|
||||||
|
@ -744,9 +744,9 @@ New features:
|
||||||
Behavior changes:
|
Behavior changes:
|
||||||
* VM CLI now supports and requires manifests to properly work with NEF files
|
* VM CLI now supports and requires manifests to properly work with NEF files
|
||||||
(#1642)
|
(#1642)
|
||||||
* NEP17-related CLI commands now output GAS balance as floating point numbers
|
* NEP-17-related CLI commands now output GAS balance as floating point numbers
|
||||||
(#1654)
|
(#1654)
|
||||||
* `--from` parameter can be omitted now for NEP17 CLI transfers, the default
|
* `--from` parameter can be omitted now for NEP-17 CLI transfers, the default
|
||||||
wallet address will be used in this case (#1655)
|
wallet address will be used in this case (#1655)
|
||||||
* native contracts now use more specific types for methods arguments (#1657)
|
* native contracts now use more specific types for methods arguments (#1657)
|
||||||
* some native contract names and IDs have changed (#1622, #1660)
|
* some native contract names and IDs have changed (#1622, #1660)
|
||||||
|
|
|
@ -53,7 +53,7 @@ func TestNEP11Import(t *testing.T) {
|
||||||
// already exists
|
// already exists
|
||||||
e.RunWithError(t, append(args, "--token", nnsContractHash.StringLE())...)
|
e.RunWithError(t, append(args, "--token", nnsContractHash.StringLE())...)
|
||||||
|
|
||||||
// not a NEP11 token
|
// not a NEP-11 token
|
||||||
e.RunWithError(t, append(args, "--token", neoContractHash.StringLE())...)
|
e.RunWithError(t, append(args, "--token", neoContractHash.StringLE())...)
|
||||||
|
|
||||||
t.Run("Info", func(t *testing.T) {
|
t.Run("Info", func(t *testing.T) {
|
||||||
|
@ -283,7 +283,7 @@ func TestNEP11_OwnerOf_BalanceOf_Transfer(t *testing.T) {
|
||||||
e.Run(t, append(cmdCheckBalance, "--token", h.StringLE())...)
|
e.Run(t, append(cmdCheckBalance, "--token", h.StringLE())...)
|
||||||
checkBalanceResult(t, nftOwnerAddr, "1") // tokenID1
|
checkBalanceResult(t, nftOwnerAddr, "1") // tokenID1
|
||||||
|
|
||||||
// transfer: good, to NEP11-Payable contract, with data
|
// transfer: good, to NEP-11-Payable contract, with data
|
||||||
verifyH := deployVerifyContract(t, e)
|
verifyH := deployVerifyContract(t, e)
|
||||||
cmdTransfer = []string{
|
cmdTransfer = []string{
|
||||||
"neo-go", "wallet", "nep11", "transfer",
|
"neo-go", "wallet", "nep11", "transfer",
|
||||||
|
|
|
@ -321,7 +321,7 @@ func TestNEP17ImportToken(t *testing.T) {
|
||||||
"--wallet", walletPath,
|
"--wallet", walletPath,
|
||||||
"--token", address.Uint160ToString(neoContractHash)) // try address instead of sh
|
"--token", address.Uint160ToString(neoContractHash)) // try address instead of sh
|
||||||
|
|
||||||
// not a NEP17 token
|
// not a NEP-17 token
|
||||||
e.RunWithError(t, "neo-go", "wallet", "nep17", "import",
|
e.RunWithError(t, "neo-go", "wallet", "nep17", "import",
|
||||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||||
"--wallet", walletPath,
|
"--wallet", walletPath,
|
||||||
|
|
4
cli/testdata/verify.go
vendored
4
cli/testdata/verify.go
vendored
|
@ -12,8 +12,8 @@ func Verify() bool {
|
||||||
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnNEP11Payment notifies about NEP11 payment. You don't call this method directly,
|
// OnNEP11Payment notifies about NEP-11 payment. You don't call this method directly,
|
||||||
// instead it's called by NEP11 contract when you transfer funds from your address
|
// instead it's called by NEP-11 contract when you transfer funds from your address
|
||||||
// to the address of this NFT contract.
|
// to the address of this NFT contract.
|
||||||
func OnNEP11Payment(from interop.Hash160, amount int, token []byte, data interface{}) {
|
func OnNEP11Payment(from interop.Hash160, amount int, token []byte, data interface{}) {
|
||||||
runtime.Notify("OnNEP11Payment", from, amount, token, data)
|
runtime.Notify("OnNEP11Payment", from, amount, token, data)
|
||||||
|
|
|
@ -52,14 +52,14 @@ func newNEP11Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "import",
|
Name: "import",
|
||||||
Usage: "import NEP11 token to a wallet",
|
Usage: "import NEP-11 token to a wallet",
|
||||||
UsageText: "import --wallet <path> --rpc-endpoint <node> --timeout <time> --token <hash>",
|
UsageText: "import --wallet <path> --rpc-endpoint <node> --timeout <time> --token <hash>",
|
||||||
Action: importNEP11Token,
|
Action: importNEP11Token,
|
||||||
Flags: importFlags,
|
Flags: importFlags,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "info",
|
Name: "info",
|
||||||
Usage: "print imported NEP11 token info",
|
Usage: "print imported NEP-11 token info",
|
||||||
UsageText: "print --wallet <path> [--token <hash-or-name>]",
|
UsageText: "print --wallet <path> [--token <hash-or-name>]",
|
||||||
Action: printNEP11Info,
|
Action: printNEP11Info,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
@ -69,7 +69,7 @@ func newNEP11Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "remove",
|
Name: "remove",
|
||||||
Usage: "remove NEP11 token from the wallet",
|
Usage: "remove NEP-11 token from the wallet",
|
||||||
UsageText: "remove --wallet <path> --token <hash-or-name>",
|
UsageText: "remove --wallet <path> --token <hash-or-name>",
|
||||||
Action: removeNEP11Token,
|
Action: removeNEP11Token,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
@ -80,13 +80,13 @@ func newNEP11Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "transfer",
|
Name: "transfer",
|
||||||
Usage: "transfer NEP11 tokens",
|
Usage: "transfer NEP-11 tokens",
|
||||||
UsageText: "transfer --wallet <path> --rpc-endpoint <node> --timeout <time> --from <addr> --to <addr> --token <hash-or-name> --id <token-id> [--amount string] [data] [-- <cosigner1:Scope> [<cosigner2> [...]]]",
|
UsageText: "transfer --wallet <path> --rpc-endpoint <node> --timeout <time> --from <addr> --to <addr> --token <hash-or-name> --id <token-id> [--amount string] [data] [-- <cosigner1:Scope> [<cosigner2> [...]]]",
|
||||||
Action: transferNEP11,
|
Action: transferNEP11,
|
||||||
Flags: transferFlags,
|
Flags: transferFlags,
|
||||||
Description: `Transfers specified NEP11 token with optional cosigners list attached to
|
Description: `Transfers specified NEP-11 token with optional cosigners list attached to
|
||||||
the transfer. Amount should be specified for divisible NEP11
|
the transfer. Amount should be specified for divisible NEP-11
|
||||||
tokens and omitted for non-divisible NEP11 tokens. See
|
tokens and omitted for non-divisible NEP-11 tokens. See
|
||||||
'contract testinvokefunction' documentation for the details
|
'contract testinvokefunction' documentation for the details
|
||||||
about cosigners syntax. If no cosigners are given then the
|
about cosigners syntax. If no cosigners are given then the
|
||||||
sender with CalledByEntry scope will be used as the only
|
sender with CalledByEntry scope will be used as the only
|
||||||
|
@ -95,7 +95,7 @@ func newNEP11Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "properties",
|
Name: "properties",
|
||||||
Usage: "print properties of NEP11 token",
|
Usage: "print properties of NEP-11 token",
|
||||||
UsageText: "properties --rpc-endpoint <node> --timeout <time> --token <hash> --id <token-id>",
|
UsageText: "properties --rpc-endpoint <node> --timeout <time> --token <hash> --id <token-id>",
|
||||||
Action: printNEP11Properties,
|
Action: printNEP11Properties,
|
||||||
Flags: append([]cli.Flag{
|
Flags: append([]cli.Flag{
|
||||||
|
@ -105,7 +105,7 @@ func newNEP11Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "ownerOf",
|
Name: "ownerOf",
|
||||||
Usage: "print owner of non-divisible NEP11 token with the specified ID",
|
Usage: "print owner of non-divisible NEP-11 token with the specified ID",
|
||||||
UsageText: "ownerOf --rpc-endpoint <node> --timeout <time> --token <hash> --id <token-id>",
|
UsageText: "ownerOf --rpc-endpoint <node> --timeout <time> --token <hash> --id <token-id>",
|
||||||
Action: printNEP11Owner,
|
Action: printNEP11Owner,
|
||||||
Flags: append([]cli.Flag{
|
Flags: append([]cli.Flag{
|
||||||
|
@ -301,7 +301,7 @@ func printNEP11Owner(ctx *cli.Context) error {
|
||||||
|
|
||||||
result, err := c.NEP11NDOwnerOf(tokenHash.Uint160(), tokenID)
|
result, err := c.NEP11NDOwnerOf(tokenHash.Uint160(), tokenID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(fmt.Sprintf("failed to call NEP11 `ownerOf` method: %s", err.Error()), 1)
|
return cli.NewExitError(fmt.Sprintf("failed to call NEP-11 `ownerOf` method: %s", err.Error()), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintln(ctx.App.Writer, address.Uint160ToString(result))
|
fmt.Fprintln(ctx.App.Writer, address.Uint160ToString(result))
|
||||||
|
@ -330,7 +330,7 @@ func printNEP11TokensOf(ctx *cli.Context) error {
|
||||||
|
|
||||||
result, err := c.NEP11TokensOf(tokenHash.Uint160(), acc.Uint160())
|
result, err := c.NEP11TokensOf(tokenHash.Uint160(), acc.Uint160())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(fmt.Sprintf("failed to call NEP11 `tokensOf` method: %s", err.Error()), 1)
|
return cli.NewExitError(fmt.Sprintf("failed to call NEP-11 `tokensOf` method: %s", err.Error()), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range result {
|
for i := range result {
|
||||||
|
@ -356,7 +356,7 @@ func printNEP11Tokens(ctx *cli.Context) error {
|
||||||
|
|
||||||
result, err := c.NEP11Tokens(tokenHash.Uint160())
|
result, err := c.NEP11Tokens(tokenHash.Uint160())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(fmt.Sprintf("failed to call optional NEP11 `tokens` method: %s", err.Error()), 1)
|
return cli.NewExitError(fmt.Sprintf("failed to call optional NEP-11 `tokens` method: %s", err.Error()), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range result {
|
for i := range result {
|
||||||
|
@ -387,7 +387,7 @@ func printNEP11Properties(ctx *cli.Context) error {
|
||||||
|
|
||||||
result, err := c.NEP11Properties(tokenHash.Uint160(), tokenID)
|
result, err := c.NEP11Properties(tokenHash.Uint160(), tokenID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(fmt.Sprintf("failed to call NEP11 `properties` method: %s", err.Error()), 1)
|
return cli.NewExitError(fmt.Sprintf("failed to call NEP-11 `properties` method: %s", err.Error()), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes, err := stackitem.ToJSON(result)
|
bytes, err := stackitem.ToJSON(result)
|
||||||
|
|
|
@ -89,14 +89,14 @@ func newNEP17Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "import",
|
Name: "import",
|
||||||
Usage: "import NEP17 token to a wallet",
|
Usage: "import NEP-17 token to a wallet",
|
||||||
UsageText: "import --wallet <path> --rpc-endpoint <node> --timeout <time> --token <hash>",
|
UsageText: "import --wallet <path> --rpc-endpoint <node> --timeout <time> --token <hash>",
|
||||||
Action: importNEP17Token,
|
Action: importNEP17Token,
|
||||||
Flags: importFlags,
|
Flags: importFlags,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "info",
|
Name: "info",
|
||||||
Usage: "print imported NEP17 token info",
|
Usage: "print imported NEP-17 token info",
|
||||||
UsageText: "print --wallet <path> [--token <hash-or-name>]",
|
UsageText: "print --wallet <path> [--token <hash-or-name>]",
|
||||||
Action: printNEP17Info,
|
Action: printNEP17Info,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
@ -106,7 +106,7 @@ func newNEP17Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "remove",
|
Name: "remove",
|
||||||
Usage: "remove NEP17 token from the wallet",
|
Usage: "remove NEP-17 token from the wallet",
|
||||||
UsageText: "remove --wallet <path> --token <hash-or-name>",
|
UsageText: "remove --wallet <path> --token <hash-or-name>",
|
||||||
Action: removeNEP17Token,
|
Action: removeNEP17Token,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
@ -117,11 +117,11 @@ func newNEP17Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "transfer",
|
Name: "transfer",
|
||||||
Usage: "transfer NEP17 tokens",
|
Usage: "transfer NEP-17 tokens",
|
||||||
UsageText: "transfer --wallet <path> --rpc-endpoint <node> --timeout <time> --from <addr> --to <addr> --token <hash-or-name> --amount string [data] [-- <cosigner1:Scope> [<cosigner2> [...]]]",
|
UsageText: "transfer --wallet <path> --rpc-endpoint <node> --timeout <time> --from <addr> --to <addr> --token <hash-or-name> --amount string [data] [-- <cosigner1:Scope> [<cosigner2> [...]]]",
|
||||||
Action: transferNEP17,
|
Action: transferNEP17,
|
||||||
Flags: transferFlags,
|
Flags: transferFlags,
|
||||||
Description: `Transfers specified NEP17 token amount with optional 'data' parameter and cosigners
|
Description: `Transfers specified NEP-17 token amount with optional 'data' parameter and cosigners
|
||||||
list attached to the transfer. See 'contract testinvokefunction' documentation
|
list attached to the transfer. See 'contract testinvokefunction' documentation
|
||||||
for the details about 'data' parameter and cosigners syntax. If no 'data' is
|
for the details about 'data' parameter and cosigners syntax. If no 'data' is
|
||||||
given then default nil value will be used. If no cosigners are given then the
|
given then default nil value will be used. If no cosigners are given then the
|
||||||
|
@ -130,7 +130,7 @@ func newNEP17Commands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "multitransfer",
|
Name: "multitransfer",
|
||||||
Usage: "transfer NEP17 tokens to multiple recipients",
|
Usage: "transfer NEP-17 tokens to multiple recipients",
|
||||||
UsageText: `multitransfer --wallet <path> --rpc-endpoint <node> --timeout <time> --from <addr>` +
|
UsageText: `multitransfer --wallet <path> --rpc-endpoint <node> --timeout <time> --from <addr>` +
|
||||||
` <token1>:<addr1>:<amount1> [<token2>:<addr2>:<amount2> [...]] [-- <cosigner1:Scope> [<cosigner2> [...]]]`,
|
` <token1>:<addr1>:<amount1> [<token2>:<addr2>:<amount2> [...]] [-- <cosigner1:Scope> [<cosigner2> [...]]]`,
|
||||||
Action: multiTransferNEP17,
|
Action: multiTransferNEP17,
|
||||||
|
@ -478,7 +478,7 @@ func multiTransferNEP17(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
cosignersAccounts, err := cmdargs.GetSignersAccounts(wall, cosigners)
|
cosignersAccounts, err := cmdargs.GetSignersAccounts(wall, cosigners)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(fmt.Errorf("failed to create NEP17 multitransfer transaction: %w", err), 1)
|
return cli.NewExitError(fmt.Errorf("failed to create NEP-17 multitransfer transaction: %w", err), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return signAndSendNEP17Transfer(ctx, c, acc, recipients, cosignersAccounts)
|
return signAndSendNEP17Transfer(ctx, c, acc, recipients, cosignersAccounts)
|
||||||
|
@ -537,7 +537,7 @@ func transferNEP(ctx *cli.Context, standard string) error {
|
||||||
}
|
}
|
||||||
cosignersAccounts, err := cmdargs.GetSignersAccounts(wall, cosigners)
|
cosignersAccounts, err := cmdargs.GetSignersAccounts(wall, cosigners)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(fmt.Errorf("failed to create NEP17 transfer transaction: %w", err), 1)
|
return cli.NewExitError(fmt.Errorf("failed to create NEP-17 transfer transaction: %w", err), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
amountArg := ctx.String("amount")
|
amountArg := ctx.String("amount")
|
||||||
|
|
|
@ -231,12 +231,12 @@ func NewCommands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "nep17",
|
Name: "nep17",
|
||||||
Usage: "work with NEP17 contracts",
|
Usage: "work with NEP-17 contracts",
|
||||||
Subcommands: newNEP17Commands(),
|
Subcommands: newNEP17Commands(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "nep11",
|
Name: "nep11",
|
||||||
Usage: "work with NEP11 contracts",
|
Usage: "work with NEP-11 contracts",
|
||||||
Subcommands: newNEP11Commands(),
|
Subcommands: newNEP11Commands(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -464,7 +464,7 @@ To print token IDs owned by the specified owner, use `tokensOf` command with
|
||||||
|
|
||||||
#### Owner Of
|
#### Owner Of
|
||||||
|
|
||||||
For non-divisible NEP-11 tokens only. To print owner of non-divisible NEP11 token
|
For non-divisible NEP-11 tokens only. To print owner of non-divisible NEP-11 token
|
||||||
use `ownerOf` method, specify token hash via `--token` flag and token ID via
|
use `ownerOf` method, specify token hash via `--token` flag and token ID via
|
||||||
`--id` flag:
|
`--id` flag:
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ See the table below for the detailed examples description.
|
||||||
| [runtime](runtime) | This contract demonstrates how to use special `_initialize` and `_deploy` methods. See the [compiler documentation](../docs/compiler.md#vm-api-interop-layer ) for methods details. It also shows the pattern for checking owner witness inside the contract with the help of `runtime.CheckWitness` interop [function](../pkg/interop/runtime/runtime.go). |
|
| [runtime](runtime) | This contract demonstrates how to use special `_initialize` and `_deploy` methods. See the [compiler documentation](../docs/compiler.md#vm-api-interop-layer ) for methods details. It also shows the pattern for checking owner witness inside the contract with the help of `runtime.CheckWitness` interop [function](../pkg/interop/runtime/runtime.go). |
|
||||||
| [storage](storage) | The contract implements API for basic operations with a contract storage. It shows hos to use `storage` interop package. See the `storage` [package documentation](../pkg/interop/storage/storage.go). |
|
| [storage](storage) | The contract implements API for basic operations with a contract storage. It shows hos to use `storage` interop package. See the `storage` [package documentation](../pkg/interop/storage/storage.go). |
|
||||||
| [timer](timer) | The idea of the contract is to count `tick` method invocations and destroy itself after the third invocation. It shows how to use `contract.Call` interop function to call, update (migrate) and destroy the contract. Please, refer to the `contract.Call` [function documentation](../pkg/interop/contract/contract.go) |
|
| [timer](timer) | The idea of the contract is to count `tick` method invocations and destroy itself after the third invocation. It shows how to use `contract.Call` interop function to call, update (migrate) and destroy the contract. Please, refer to the `contract.Call` [function documentation](../pkg/interop/contract/contract.go) |
|
||||||
| [token](token) | This contract implements NEP17 token standard (like NEO and GAS tokens) with all required methods and operations. See the NEP17 token standard [specification](https://github.com/neo-project/proposals/pull/126) for details. |
|
| [token](token) | This contract implements NEP-17 token standard (like NEO and GAS tokens) with all required methods and operations. See the NEP-17 token standard [specification](https://github.com/neo-project/proposals/pull/126) for details. |
|
||||||
| [token-sale](token-sale) | The contract represents a token with `allowance`. It means that the token owner should approve token withdrawing before the transfer. The contract demonstrates how interop packages can be combined to work together. |
|
| [token-sale](token-sale) | The contract represents a token with `allowance`. It means that the token owner should approve token withdrawing before the transfer. The contract demonstrates how interop packages can be combined to work together. |
|
||||||
|
|
||||||
## Compile
|
## Compile
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package nns contains non-divisible non-fungible NEP11-compatible token
|
Package nns contains non-divisible non-fungible NEP-11-compatible token
|
||||||
implementation. This token is a compatible analogue of C# Neo Name Service
|
implementation. This token is a compatible analogue of C# Neo Name Service
|
||||||
token and is aimed to serve as a domain name service for Neo smart-contracts,
|
token and is aimed to serve as a domain name service for Neo smart-contracts,
|
||||||
thus it's NeoNameService. This token can be minted with new domain name
|
thus it's NeoNameService. This token can be minted with new domain name
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package nft contains non-divisible non-fungible NEP11-compatible token
|
Package nft contains non-divisible non-fungible NEP-11-compatible token
|
||||||
implementation. This token can be minted with GAS transfer to contract address,
|
implementation. This token can be minted with GAS transfer to contract address,
|
||||||
it will hash some data (including data provided in transfer) and produce
|
it will hash some data (including data provided in transfer) and produce
|
||||||
base64-encoded string that is your NFT. Since it's based on hashing and basically
|
base64-encoded string that is your NFT. Since it's based on hashing and basically
|
||||||
|
|
|
@ -541,7 +541,7 @@ func (bc *Blockchain) jumpToStateInternal(p uint32, stage stateJumpStage) error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to remove outdated state data for the genesis block: %w", err)
|
return fmt.Errorf("failed to remove outdated state data for the genesis block: %w", err)
|
||||||
}
|
}
|
||||||
// TODO: remove NEP17 transfers and NEP17 transfer info for genesis block, #2096 related.
|
// TODO: remove NEP-17 transfers and NEP-17 transfer info for genesis block, #2096 related.
|
||||||
_, err = cache.Persist()
|
_, err = cache.Persist()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to drop genesis block state: %w", err)
|
return fmt.Errorf("failed to drop genesis block state: %w", err)
|
||||||
|
@ -1404,7 +1404,7 @@ func appendTokenTransfer(cache dao.DAO, transCache map[util.Uint160]transferData
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForEachNEP17Transfer executes f for each nep17 transfer in log.
|
// ForEachNEP17Transfer executes f for each NEP-17 transfer in log.
|
||||||
func (bc *Blockchain) ForEachNEP17Transfer(acc util.Uint160, f func(*state.NEP17Transfer) (bool, error)) error {
|
func (bc *Blockchain) ForEachNEP17Transfer(acc util.Uint160, f func(*state.NEP17Transfer) (bool, error)) error {
|
||||||
balances, err := bc.dao.GetTokenTransferInfo(acc)
|
balances, err := bc.dao.GetTokenTransferInfo(acc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1426,7 +1426,7 @@ func (bc *Blockchain) ForEachNEP17Transfer(acc util.Uint160, f func(*state.NEP17
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForEachNEP11Transfer executes f for each nep11 transfer in log.
|
// ForEachNEP11Transfer executes f for each NEP-11 transfer in log.
|
||||||
func (bc *Blockchain) ForEachNEP11Transfer(acc util.Uint160, f func(*state.NEP11Transfer) (bool, error)) error {
|
func (bc *Blockchain) ForEachNEP11Transfer(acc util.Uint160, f func(*state.NEP11Transfer) (bool, error)) error {
|
||||||
balances, err := bc.dao.GetTokenTransferInfo(acc)
|
balances, err := bc.dao.GetTokenTransferInfo(acc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1448,12 +1448,12 @@ func (bc *Blockchain) ForEachNEP11Transfer(acc util.Uint160, f func(*state.NEP11
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNEP17Contracts returns the list of deployed NEP17 contracts.
|
// GetNEP17Contracts returns the list of deployed NEP-17 contracts.
|
||||||
func (bc *Blockchain) GetNEP17Contracts() []util.Uint160 {
|
func (bc *Blockchain) GetNEP17Contracts() []util.Uint160 {
|
||||||
return bc.contracts.Management.GetNEP17Contracts()
|
return bc.contracts.Management.GetNEP17Contracts()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNEP11Contracts returns the list of deployed NEP11 contracts.
|
// GetNEP11Contracts returns the list of deployed NEP-11 contracts.
|
||||||
func (bc *Blockchain) GetNEP11Contracts() []util.Uint160 {
|
func (bc *Blockchain) GetNEP11Contracts() []util.Uint160 {
|
||||||
return bc.contracts.Management.GetNEP11Contracts()
|
return bc.contracts.Management.GetNEP11Contracts()
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,9 +149,9 @@ func (dao *Simple) GetContractScriptHash(id int32) (util.Uint160, error) {
|
||||||
return *data, nil
|
return *data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- start nep17 transfer info.
|
// -- start NEP-17 transfer info.
|
||||||
|
|
||||||
// GetTokenTransferInfo retrieves nep17 transfer info from the cache.
|
// GetTokenTransferInfo retrieves NEP-17 transfer info from the cache.
|
||||||
func (dao *Simple) GetTokenTransferInfo(acc util.Uint160) (*state.TokenTransferInfo, error) {
|
func (dao *Simple) GetTokenTransferInfo(acc util.Uint160) (*state.TokenTransferInfo, error) {
|
||||||
key := storage.AppendPrefix(storage.STTokenTransferInfo, acc.BytesBE())
|
key := storage.AppendPrefix(storage.STTokenTransferInfo, acc.BytesBE())
|
||||||
bs := state.NewTokenTransferInfo()
|
bs := state.NewTokenTransferInfo()
|
||||||
|
@ -162,7 +162,7 @@ func (dao *Simple) GetTokenTransferInfo(acc util.Uint160) (*state.TokenTransferI
|
||||||
return bs, nil
|
return bs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutTokenTransferInfo saves nep17 transfer info in the cache.
|
// PutTokenTransferInfo saves NEP-17 transfer info in the cache.
|
||||||
func (dao *Simple) PutTokenTransferInfo(acc util.Uint160, bs *state.TokenTransferInfo) error {
|
func (dao *Simple) PutTokenTransferInfo(acc util.Uint160, bs *state.TokenTransferInfo) error {
|
||||||
return dao.putTokenTransferInfo(acc, bs, io.NewBufBinWriter())
|
return dao.putTokenTransferInfo(acc, bs, io.NewBufBinWriter())
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ func (dao *Simple) putTokenTransferInfo(acc util.Uint160, bs *state.TokenTransfe
|
||||||
return dao.putWithBuffer(bs, key, buf)
|
return dao.putWithBuffer(bs, key, buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- end nep17 transfer info.
|
// -- end NEP-17 transfer info.
|
||||||
|
|
||||||
// -- start transfer log.
|
// -- start transfer log.
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,7 @@ func newNEP17TransferWithAssert(sc, from, to util.Uint160, amount int64, needAss
|
||||||
emit.Opcodes(w.BinWriter, opcode.ASSERT)
|
emit.Opcodes(w.BinWriter, opcode.ASSERT)
|
||||||
}
|
}
|
||||||
if w.Err != nil {
|
if w.Err != nil {
|
||||||
panic(fmt.Errorf("failed to create nep17 transfer transaction: %w", w.Err))
|
panic(fmt.Errorf("failed to create NEP-17 transfer transaction: %w", w.Err))
|
||||||
}
|
}
|
||||||
|
|
||||||
script := w.Bytes()
|
script := w.Bytes()
|
||||||
|
|
|
@ -35,7 +35,7 @@ type Management struct {
|
||||||
contracts map[util.Uint160]*state.Contract
|
contracts map[util.Uint160]*state.Contract
|
||||||
// nep11 is a map of NEP11-compliant contracts which is updated with every PostPersist.
|
// nep11 is a map of NEP11-compliant contracts which is updated with every PostPersist.
|
||||||
nep11 map[util.Uint160]struct{}
|
nep11 map[util.Uint160]struct{}
|
||||||
// nep17 is a map of NEP17-compliant contracts which is updated with every PostPersist.
|
// nep17 is a map of NEP-17-compliant contracts which is updated with every PostPersist.
|
||||||
nep17 map[util.Uint160]struct{}
|
nep17 map[util.Uint160]struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ func (m *Management) GetNEP11Contracts() []util.Uint160 {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNEP17Contracts returns hashes of all deployed contracts that support NEP17 standard. The list
|
// GetNEP17Contracts returns hashes of all deployed contracts that support NEP-17 standard. The list
|
||||||
// is updated every PostPersist, so until PostPersist is called, the result for the previous block
|
// is updated every PostPersist, so until PostPersist is called, the result for the previous block
|
||||||
// is returned.
|
// is returned.
|
||||||
func (m *Management) GetNEP17Contracts() []util.Uint160 {
|
func (m *Management) GetNEP17Contracts() []util.Uint160 {
|
||||||
|
|
|
@ -92,7 +92,7 @@ func TestManagement_GetNEP17Contracts(t *testing.T) {
|
||||||
|
|
||||||
require.Empty(t, mgmt.GetNEP17Contracts())
|
require.Empty(t, mgmt.GetNEP17Contracts())
|
||||||
|
|
||||||
// Deploy NEP17 contract
|
// Deploy NEP-17 contract
|
||||||
script := []byte{byte(opcode.RET)}
|
script := []byte{byte(opcode.RET)}
|
||||||
sender := util.Uint160{1, 2, 3}
|
sender := util.Uint160{1, 2, 3}
|
||||||
ne, err := nef.NewFile(script)
|
ne, err := nef.NewFile(script)
|
||||||
|
@ -107,7 +107,7 @@ func TestManagement_GetNEP17Contracts(t *testing.T) {
|
||||||
c1, err := mgmt.Deploy(d, sender, ne, manif)
|
c1, err := mgmt.Deploy(d, sender, ne, manif)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// PostPersist is not yet called, thus no NEP17 contracts are expected
|
// PostPersist is not yet called, thus no NEP-17 contracts are expected
|
||||||
require.Empty(t, mgmt.GetNEP17Contracts())
|
require.Empty(t, mgmt.GetNEP17Contracts())
|
||||||
|
|
||||||
// Call PostPersist, check c1 contract hash is returned
|
// Call PostPersist, check c1 contract hash is returned
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NEP17Balance represents balance state of a NEP17-token.
|
// NEP17Balance represents balance state of a NEP-17-token.
|
||||||
type NEP17Balance struct {
|
type NEP17Balance struct {
|
||||||
Balance big.Int
|
Balance big.Int
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@ type TokenTransferLog struct {
|
||||||
Raw []byte
|
Raw []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP17Transfer represents a single NEP17 Transfer event.
|
// NEP17Transfer represents a single NEP-17 Transfer event.
|
||||||
type NEP17Transfer struct {
|
type NEP17Transfer struct {
|
||||||
// Asset is a NEP17 contract ID.
|
// Asset is a NEP-17 contract ID.
|
||||||
Asset int32
|
Asset int32
|
||||||
// Address is the address of the sender.
|
// Address is the address of the sender.
|
||||||
From util.Uint160
|
From util.Uint160
|
||||||
|
|
|
@ -16,33 +16,33 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/wallet"
|
"github.com/nspcc-dev/neo-go/pkg/wallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NEP11Decimals invokes `decimals` NEP11 method on a specified contract.
|
// NEP11Decimals invokes `decimals` NEP-11 method on a specified contract.
|
||||||
func (c *Client) NEP11Decimals(tokenHash util.Uint160) (int64, error) {
|
func (c *Client) NEP11Decimals(tokenHash util.Uint160) (int64, error) {
|
||||||
return c.nepDecimals(tokenHash)
|
return c.nepDecimals(tokenHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP11Symbol invokes `symbol` NEP11 method on a specified contract.
|
// NEP11Symbol invokes `symbol` NEP-11 method on a specified contract.
|
||||||
func (c *Client) NEP11Symbol(tokenHash util.Uint160) (string, error) {
|
func (c *Client) NEP11Symbol(tokenHash util.Uint160) (string, error) {
|
||||||
return c.nepSymbol(tokenHash)
|
return c.nepSymbol(tokenHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP11TotalSupply invokes `totalSupply` NEP11 method on a specified contract.
|
// NEP11TotalSupply invokes `totalSupply` NEP-11 method on a specified contract.
|
||||||
func (c *Client) NEP11TotalSupply(tokenHash util.Uint160) (int64, error) {
|
func (c *Client) NEP11TotalSupply(tokenHash util.Uint160) (int64, error) {
|
||||||
return c.nepTotalSupply(tokenHash)
|
return c.nepTotalSupply(tokenHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP11BalanceOf invokes `balanceOf` NEP11 method on a specified contract.
|
// NEP11BalanceOf invokes `balanceOf` NEP-11 method on a specified contract.
|
||||||
func (c *Client) NEP11BalanceOf(tokenHash, owner util.Uint160) (int64, error) {
|
func (c *Client) NEP11BalanceOf(tokenHash, owner util.Uint160) (int64, error) {
|
||||||
return c.nepBalanceOf(tokenHash, owner, nil)
|
return c.nepBalanceOf(tokenHash, owner, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP11TokenInfo returns full NEP11 token info.
|
// NEP11TokenInfo returns full NEP-11 token info.
|
||||||
func (c *Client) NEP11TokenInfo(tokenHash util.Uint160) (*wallet.Token, error) {
|
func (c *Client) NEP11TokenInfo(tokenHash util.Uint160) (*wallet.Token, error) {
|
||||||
return c.nepTokenInfo(tokenHash, manifest.NEP11StandardName)
|
return c.nepTokenInfo(tokenHash, manifest.NEP11StandardName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TransferNEP11 creates an invocation transaction that invokes 'transfer' method
|
// TransferNEP11 creates an invocation transaction that invokes 'transfer' method
|
||||||
// on a given token to move the whole NEP11 token with the specified token ID to
|
// on a given token to move the whole NEP-11 token with the specified token ID to
|
||||||
// given account and sends it to the network returning just a hash of it.
|
// given account and sends it to the network returning just a hash of it.
|
||||||
func (c *Client) TransferNEP11(acc *wallet.Account, to util.Uint160,
|
func (c *Client) TransferNEP11(acc *wallet.Account, to util.Uint160,
|
||||||
tokenHash util.Uint160, tokenID string, data interface{}, gas int64, cosigners []SignerAccount) (util.Uint256, error) {
|
tokenHash util.Uint160, tokenID string, data interface{}, gas int64, cosigners []SignerAccount) (util.Uint256, error) {
|
||||||
|
@ -59,7 +59,7 @@ func (c *Client) TransferNEP11(acc *wallet.Account, to util.Uint160,
|
||||||
|
|
||||||
// CreateNEP11TransferTx creates an invocation transaction for the 'transfer'
|
// CreateNEP11TransferTx creates an invocation transaction for the 'transfer'
|
||||||
// method of a given contract (token) to move the whole (or the specified amount
|
// method of a given contract (token) to move the whole (or the specified amount
|
||||||
// of) NEP11 token with the specified token ID to given account and returns it.
|
// of) NEP-11 token with the specified token ID to given account and returns it.
|
||||||
// The returned transaction is not signed. CreateNEP11TransferTx is also a
|
// The returned transaction is not signed. CreateNEP11TransferTx is also a
|
||||||
// helper for TransferNEP11 and TransferNEP11D.
|
// helper for TransferNEP11 and TransferNEP11D.
|
||||||
// `args` for TransferNEP11: to util.Uint160, tokenID string, data interface{};
|
// `args` for TransferNEP11: to util.Uint160, tokenID string, data interface{};
|
||||||
|
@ -70,7 +70,7 @@ func (c *Client) CreateNEP11TransferTx(acc *wallet.Account, tokenHash util.Uint1
|
||||||
emit.AppCall(w.BinWriter, tokenHash, "transfer", callflag.All, args...)
|
emit.AppCall(w.BinWriter, tokenHash, "transfer", callflag.All, args...)
|
||||||
emit.Opcodes(w.BinWriter, opcode.ASSERT)
|
emit.Opcodes(w.BinWriter, opcode.ASSERT)
|
||||||
if w.Err != nil {
|
if w.Err != nil {
|
||||||
return nil, fmt.Errorf("failed to create NEP11 transfer script: %w", w.Err)
|
return nil, fmt.Errorf("failed to create NEP-11 transfer script: %w", w.Err)
|
||||||
}
|
}
|
||||||
from, err := address.StringToUint160(acc.Address)
|
from, err := address.StringToUint160(acc.Address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -114,7 +114,7 @@ func (c *Client) NEP11TokensOf(tokenHash util.Uint160, owner util.Uint160) ([]st
|
||||||
|
|
||||||
// Non-divisible NFT methods section start.
|
// Non-divisible NFT methods section start.
|
||||||
|
|
||||||
// NEP11NDOwnerOf invokes `ownerOf` non-devisible NEP11 method with the
|
// NEP11NDOwnerOf invokes `ownerOf` non-devisible NEP-11 method with the
|
||||||
// specified token ID on a specified contract.
|
// specified token ID on a specified contract.
|
||||||
func (c *Client) NEP11NDOwnerOf(tokenHash util.Uint160, tokenID string) (util.Uint160, error) {
|
func (c *Client) NEP11NDOwnerOf(tokenHash util.Uint160, tokenID string) (util.Uint160, error) {
|
||||||
result, err := c.InvokeFunction(tokenHash, "ownerOf", []smartcontract.Parameter{
|
result, err := c.InvokeFunction(tokenHash, "ownerOf", []smartcontract.Parameter{
|
||||||
|
@ -139,7 +139,7 @@ func (c *Client) NEP11NDOwnerOf(tokenHash util.Uint160, tokenID string) (util.Ui
|
||||||
// Divisible NFT methods section start.
|
// Divisible NFT methods section start.
|
||||||
|
|
||||||
// TransferNEP11D creates an invocation transaction that invokes 'transfer'
|
// TransferNEP11D creates an invocation transaction that invokes 'transfer'
|
||||||
// method on a given token to move specified amount of divisible NEP11 assets
|
// method on a given token to move specified amount of divisible NEP-11 assets
|
||||||
// (in FixedN format using contract's number of decimals) to given account and
|
// (in FixedN format using contract's number of decimals) to given account and
|
||||||
// sends it to the network returning just a hash of it.
|
// sends it to the network returning just a hash of it.
|
||||||
func (c *Client) TransferNEP11D(acc *wallet.Account, to util.Uint160,
|
func (c *Client) TransferNEP11D(acc *wallet.Account, to util.Uint160,
|
||||||
|
@ -159,13 +159,13 @@ func (c *Client) TransferNEP11D(acc *wallet.Account, to util.Uint160,
|
||||||
return c.SignAndPushTx(tx, acc, cosigners)
|
return c.SignAndPushTx(tx, acc, cosigners)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP11DBalanceOf invokes `balanceOf` divisible NEP11 method on a
|
// NEP11DBalanceOf invokes `balanceOf` divisible NEP-11 method on a
|
||||||
// specified contract.
|
// specified contract.
|
||||||
func (c *Client) NEP11DBalanceOf(tokenHash, owner util.Uint160, tokenID string) (int64, error) {
|
func (c *Client) NEP11DBalanceOf(tokenHash, owner util.Uint160, tokenID string) (int64, error) {
|
||||||
return c.nepBalanceOf(tokenHash, owner, &tokenID)
|
return c.nepBalanceOf(tokenHash, owner, &tokenID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP11DOwnerOf returns list of the specified NEP11 divisible token owners.
|
// NEP11DOwnerOf returns list of the specified NEP-11 divisible token owners.
|
||||||
func (c *Client) NEP11DOwnerOf(tokenHash util.Uint160, tokenID string) ([]util.Uint160, error) {
|
func (c *Client) NEP11DOwnerOf(tokenHash util.Uint160, tokenID string) ([]util.Uint160, error) {
|
||||||
result, err := c.InvokeFunction(tokenHash, "ownerOf", []smartcontract.Parameter{
|
result, err := c.InvokeFunction(tokenHash, "ownerOf", []smartcontract.Parameter{
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ func (c *Client) NEP11DOwnerOf(tokenHash util.Uint160, tokenID string) ([]util.U
|
||||||
|
|
||||||
// Optional NFT methods section start.
|
// Optional NFT methods section start.
|
||||||
|
|
||||||
// NEP11Properties invokes `properties` optional NEP11 method on a
|
// NEP11Properties invokes `properties` optional NEP-11 method on a
|
||||||
// specified contract.
|
// specified contract.
|
||||||
func (c *Client) NEP11Properties(tokenHash util.Uint160, tokenID string) (*stackitem.Map, error) {
|
func (c *Client) NEP11Properties(tokenHash util.Uint160, tokenID string) (*stackitem.Map, error) {
|
||||||
result, err := c.InvokeFunction(tokenHash, "properties", []smartcontract.Parameter{{
|
result, err := c.InvokeFunction(tokenHash, "properties", []smartcontract.Parameter{{
|
||||||
|
|
|
@ -29,33 +29,33 @@ type SignerAccount struct {
|
||||||
Account *wallet.Account
|
Account *wallet.Account
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP17Decimals invokes `decimals` NEP17 method on a specified contract.
|
// NEP17Decimals invokes `decimals` NEP-17 method on a specified contract.
|
||||||
func (c *Client) NEP17Decimals(tokenHash util.Uint160) (int64, error) {
|
func (c *Client) NEP17Decimals(tokenHash util.Uint160) (int64, error) {
|
||||||
return c.nepDecimals(tokenHash)
|
return c.nepDecimals(tokenHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP17Symbol invokes `symbol` NEP17 method on a specified contract.
|
// NEP17Symbol invokes `symbol` NEP-17 method on a specified contract.
|
||||||
func (c *Client) NEP17Symbol(tokenHash util.Uint160) (string, error) {
|
func (c *Client) NEP17Symbol(tokenHash util.Uint160) (string, error) {
|
||||||
return c.nepSymbol(tokenHash)
|
return c.nepSymbol(tokenHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP17TotalSupply invokes `totalSupply` NEP17 method on a specified contract.
|
// NEP17TotalSupply invokes `totalSupply` NEP-17 method on a specified contract.
|
||||||
func (c *Client) NEP17TotalSupply(tokenHash util.Uint160) (int64, error) {
|
func (c *Client) NEP17TotalSupply(tokenHash util.Uint160) (int64, error) {
|
||||||
return c.nepTotalSupply(tokenHash)
|
return c.nepTotalSupply(tokenHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP17BalanceOf invokes `balanceOf` NEP17 method on a specified contract.
|
// NEP17BalanceOf invokes `balanceOf` NEP-17 method on a specified contract.
|
||||||
func (c *Client) NEP17BalanceOf(tokenHash, acc util.Uint160) (int64, error) {
|
func (c *Client) NEP17BalanceOf(tokenHash, acc util.Uint160) (int64, error) {
|
||||||
return c.nepBalanceOf(tokenHash, acc, nil)
|
return c.nepBalanceOf(tokenHash, acc, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEP17TokenInfo returns full NEP17 token info.
|
// NEP17TokenInfo returns full NEP-17 token info.
|
||||||
func (c *Client) NEP17TokenInfo(tokenHash util.Uint160) (*wallet.Token, error) {
|
func (c *Client) NEP17TokenInfo(tokenHash util.Uint160) (*wallet.Token, error) {
|
||||||
return c.nepTokenInfo(tokenHash, manifest.NEP17StandardName)
|
return c.nepTokenInfo(tokenHash, manifest.NEP17StandardName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateNEP17TransferTx creates an invocation transaction for the 'transfer'
|
// CreateNEP17TransferTx creates an invocation transaction for the 'transfer'
|
||||||
// method of a given contract (token) to move specified amount of NEP17 assets
|
// method of a given contract (token) to move specified amount of NEP-17 assets
|
||||||
// (in FixedN format using contract's number of decimals) to given account and
|
// (in FixedN format using contract's number of decimals) to given account and
|
||||||
// returns it. The returned transaction is not signed.
|
// returns it. The returned transaction is not signed.
|
||||||
func (c *Client) CreateNEP17TransferTx(acc *wallet.Account, to util.Uint160,
|
func (c *Client) CreateNEP17TransferTx(acc *wallet.Account, to util.Uint160,
|
||||||
|
@ -70,7 +70,7 @@ func (c *Client) CreateNEP17TransferTx(acc *wallet.Account, to util.Uint160,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateNEP17MultiTransferTx creates an invocation transaction for performing
|
// CreateNEP17MultiTransferTx creates an invocation transaction for performing
|
||||||
// NEP17 transfers from a single sender to multiple recipients with the given
|
// NEP-17 transfers from a single sender to multiple recipients with the given
|
||||||
// data and cosigners. Transaction's sender is included with the CalledByEntry
|
// data and cosigners. Transaction's sender is included with the CalledByEntry
|
||||||
// scope by default.
|
// scope by default.
|
||||||
func (c *Client) CreateNEP17MultiTransferTx(acc *wallet.Account, gas int64,
|
func (c *Client) CreateNEP17MultiTransferTx(acc *wallet.Account, gas int64,
|
||||||
|
@ -134,7 +134,7 @@ func (c *Client) CreateTxFromScript(script []byte, acc *wallet.Account, sysFee,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TransferNEP17 creates an invocation transaction that invokes 'transfer' method
|
// TransferNEP17 creates an invocation transaction that invokes 'transfer' method
|
||||||
// on a given token to move specified amount of NEP17 assets (in FixedN format
|
// on a given token to move specified amount of NEP-17 assets (in FixedN format
|
||||||
// using contract's number of decimals) to given account with data specified and
|
// using contract's number of decimals) to given account with data specified and
|
||||||
// sends it to the network returning just a hash of it. Cosigners argument
|
// sends it to the network returning just a hash of it. Cosigners argument
|
||||||
// specifies a set of the transaction cosigners (may be nil or may include sender)
|
// specifies a set of the transaction cosigners (may be nil or may include sender)
|
||||||
|
|
|
@ -682,7 +682,7 @@ func (s *Server) getNEP11Balances(ps request.Params) (interface{}, *response.Err
|
||||||
}
|
}
|
||||||
lastUpdated, err := s.chain.GetTokenLastUpdated(u)
|
lastUpdated, err := s.chain.GetTokenLastUpdated(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, response.NewRPCError("Failed to get NEP11 last updated block", err.Error(), err)
|
return nil, response.NewRPCError("Failed to get NEP-11 last updated block", err.Error(), err)
|
||||||
}
|
}
|
||||||
var count int
|
var count int
|
||||||
stateSyncPoint := lastUpdated[math.MinInt32]
|
stateSyncPoint := lastUpdated[math.MinInt32]
|
||||||
|
@ -804,7 +804,7 @@ func (s *Server) getNEP17Balances(ps request.Params) (interface{}, *response.Err
|
||||||
}
|
}
|
||||||
lastUpdated, err := s.chain.GetTokenLastUpdated(u)
|
lastUpdated, err := s.chain.GetTokenLastUpdated(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, response.NewRPCError("Failed to get NEP17 last updated block", err.Error(), err)
|
return nil, response.NewRPCError("Failed to get NEP-17 last updated block", err.Error(), err)
|
||||||
}
|
}
|
||||||
stateSyncPoint := lastUpdated[math.MinInt32]
|
stateSyncPoint := lastUpdated[math.MinInt32]
|
||||||
bw := io.NewBufBinWriter()
|
bw := io.NewBufBinWriter()
|
||||||
|
|
|
@ -15,9 +15,9 @@ const (
|
||||||
// MaxManifestSize is a max length for a valid contract manifest.
|
// MaxManifestSize is a max length for a valid contract manifest.
|
||||||
MaxManifestSize = math.MaxUint16
|
MaxManifestSize = math.MaxUint16
|
||||||
|
|
||||||
// NEP11StandardName represents the name of NEP11 smartcontract standard.
|
// NEP11StandardName represents the name of NEP-11 smartcontract standard.
|
||||||
NEP11StandardName = "NEP-11"
|
NEP11StandardName = "NEP-11"
|
||||||
// NEP17StandardName represents the name of NEP17 smartcontract standard.
|
// NEP17StandardName represents the name of NEP-17 smartcontract standard.
|
||||||
NEP17StandardName = "NEP-17"
|
NEP17StandardName = "NEP-17"
|
||||||
// NEP11Payable represents the name of contract interface which can receive NEP-11 tokens.
|
// NEP11Payable represents the name of contract interface which can receive NEP-11 tokens.
|
||||||
NEP11Payable = "NEP-11-Payable"
|
NEP11Payable = "NEP-11-Payable"
|
||||||
|
|
|
@ -14,9 +14,9 @@ func TestToken_MarshalJSON(t *testing.T) {
|
||||||
h, err := util.Uint160DecodeStringLE("f8d448b227991cf07cb96a6f9c0322437f1599b9")
|
h, err := util.Uint160DecodeStringLE("f8d448b227991cf07cb96a6f9c0322437f1599b9")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
tok := NewToken(h, "NEP17 Standard", "NEP17", 8, manifest.NEP17StandardName)
|
tok := NewToken(h, "NEP-17 standard token", "NEPT", 8, manifest.NEP17StandardName)
|
||||||
require.Equal(t, "NEP17 Standard", tok.Name)
|
require.Equal(t, "NEP-17 standard token", tok.Name)
|
||||||
require.Equal(t, "NEP17", tok.Symbol)
|
require.Equal(t, "NEPT", tok.Symbol)
|
||||||
require.EqualValues(t, 8, tok.Decimals)
|
require.EqualValues(t, 8, tok.Decimals)
|
||||||
require.Equal(t, h, tok.Hash)
|
require.Equal(t, h, tok.Hash)
|
||||||
require.Equal(t, "NcqKahsZ93ZyYS5bep8G2TY1zRB7tfUPdK", tok.Address())
|
require.Equal(t, "NcqKahsZ93ZyYS5bep8G2TY1zRB7tfUPdK", tok.Address())
|
||||||
|
|
Loading…
Reference in a new issue