Commit graph

122 commits

Author SHA1 Message Date
Anna Shaleva
9dcceadab6 examples: update neo-go dependency 2022-04-05 10:50:50 +03:00
Anna Shaleva
7b5ff25a40 gomod: update interop dependency 2022-04-05 10:49:10 +03:00
Anna Shaleva
31aa90d6b5 examples: update neo-go dependency 2022-04-05 10:46:11 +03:00
Anna Shaleva
5388c895d2 gomod: update interop version 2022-04-05 10:39:58 +03:00
Roman Khimov
fe27ae9b96 examples: completely rework runtime example
Make it more useful, triggers are largely obsolete (2.x thing).
2022-03-25 16:47:15 +03:00
Roman Khimov
ab6fe44cab examples: add a note on tests for nft-nd-nns 2022-03-23 22:23:58 +03:00
Roman Khimov
2c70f41e51 examples: move nft-nd-nns test into the same package
Which is the way Go tests are normally stored.
2022-03-23 22:21:07 +03:00
Roman Khimov
3070c2e7fc examples: polish iterator
Use read only context where appropriate, shorten notifications, fix comment.
2022-03-23 22:05:40 +03:00
Roman Khimov
1d1b4d4c18 examples: extend iterator with more storage options 2022-03-23 22:04:17 +03:00
Roman Khimov
4c4e9c0371 examples: add something to the storage for iterator example 2022-03-23 22:02:19 +03:00
Roman Khimov
26c3a6c161 examples: drop token-sale contract
It makes zero sense, it's not what it says it
is. AmountPerNEO/MaxExchangeLimitRound are not used at all to affect minting
and allowance/transferFrom features are largely obsolete. We have proper
minting implemented in NFT contracts and there is a nice NEP-17 available
also.
2022-03-23 18:22:16 +03:00
Roman Khimov
a5979f6d64 examples: add defer/recover to OnNEP17Payment handlers
Transaction must be ABORTed, exceptions are not sufficient.
2022-03-23 11:58:07 +03:00
Roman Khimov
0da34967f6 examples: update go.sum/go.mod in nft-nd-nns 2022-03-21 18:22:48 +03:00
Roman Khimov
3b639f518e *: update go.* for the previous change 2022-03-21 17:44:33 +03:00
Roman Khimov
e312e2640b examples: bump neo-go version for nft-nd-nns 2022-03-21 15:09:57 +03:00
Roman Khimov
25d72db8b0 *: update go.sum/go.mod wrt previous change 2022-03-21 14:39:05 +03:00
AnnaShaleva
f6ac8daae6 examples: update neo-go dependency of nft-nd-nns 2022-03-18 13:46:47 +03:00
AnnaShaleva
7a8dc11791 examples: update dependencies version 2022-03-18 13:44:33 +03:00
Anna Shaleva
a137552b16 gomod: upgrade minimum required go version up to 1.16 2022-03-18 11:09:23 +03:00
Evgeniy Stratonikov
4960766019 go.mod: update pkg/interop dependency
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-15 17:15:40 +03:00
Evgeniy Stratonikov
dfedae3f84 examples/nft-nd-nns: update tests dependency
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-15 17:15:40 +03:00
AnnaShaleva
992d74d193 examples: update version of neo-go 2022-03-01 19:08:22 +03:00
AnnaShaleva
abf719dcde gomod: update version of interop package 2022-03-01 19:08:22 +03:00
Anna Shaleva
3c75f047c1 cli: refactor nep11-related commands and add tests
Specify tokenID via hex-encoded string.
2022-02-09 11:47:27 +03:00
Anna Shaleva
22c39d3916 examples: properly store owner of nft-d token 2022-02-07 11:38:04 +03:00
Roman Khimov
7945097543 native: fix ContractManagement's call flags for update/deploy
See neo-project/neo#2653.
2022-02-01 12:21:00 +03:00
Evgeniy Stratonikov
ec663e5bc6 examples/nft-nd-nns: update go.mod dependencies
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:42:47 +03:00
Evgeniy Stratonikov
1154eae3cd examples: use proper interop version in go.mod
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:37:26 +03:00
Anna Shaleva
5561b94698 examples: add an example of NEP11 Divisible token 2022-01-24 13:10:10 +03:00
Evgeniy Stratonikov
ad65d1fa1f compiler: implement custom logic for go1.15
For some reason `foo.go` is interpreted as an http URL, and even if we
replace it with `./foo.go` there is an errors with file missing on disk.
Because `CompileWithOptions` should be able to compile file under any
circumstances, we allocate temporary directory base on version used to
compile a binary.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-21 17:43:28 +03:00
Evgeniy Stratonikov
d19c0492d4 examples: use a separate go.mod for each contract
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-21 10:22:29 +03:00
Roman Khimov
aa06770b3d
Merge pull request #2266 from nspcc-dev/nep-11-tracking
NEP-11 tracking
2021-11-19 13:07:37 +03:00
Roman Khimov
ce9d0b22cf *: 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.
2021-11-19 12:58:46 +03:00
Anna Shaleva
1194361826 neotest: check deployed contract hash 2021-11-16 18:53:04 +03:00
Roman Khimov
0a7f8afcea
Merge pull request #2229 from nspcc-dev/contract-test
Generic contract testing infrastructure
2021-11-11 11:46:55 +03:00
Evgeniy Stratonikov
bef2a6f7ae neotest: provide both validator and committee
It will become useful for multi-node committee.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
950adb7b89 neotest: support painless multi-signing
Implementing a separate `Signer` interface is beneficial in multiple
ways:
1. Support both single and multiple transaction witnesses.
2. It should be easy to add contract signer this way.

Tests should use accounts created with `NewAccount` so hiding all
details doesn't seem to be an issue.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
1f9fd4a472 neotest: add contract client wrapper
Reduces amount of boilerplate code in tests.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
e3625152c6 core: move NNS test out of core
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Anna Shaleva
5593d51d1a examples: adjust NEP17 and token-sale examples
Do not store zero receiver balance in the contract storage.
2021-11-08 14:00:57 +03:00
Evgeniy Stratonikov
7758378d28 compiler: allow to overload methods in manifest
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-29 20:15:21 +03:00
Roman Khimov
42a9d3d7b8 nef: add Source field
Follow neo-project/neo#2605.
2021-09-24 00:19:37 +03:00
Anna Shaleva
6594099846 examples: rename Migrate methods to Update
It's a remnant from N2, so this commit unifies style of all
update-related methods.
2021-09-20 21:56:06 +03:00
Roman Khimov
15e8fc08ce nft-nd-nns: more checks for IPv6
neo-project/non-native-contracts#7
2021-09-10 16:30:45 +03:00
Roman Khimov
aaccf748ac nft-nd-nns: add getAllRecords method
See neo-project/non-native-contracts#5.
2021-09-10 16:30:45 +03:00
Roman Khimov
137d1a3ac1 examples: additional check for IPv6 completeness
See neo-project/non-native-contracts#4.
2021-09-09 19:35:17 +03:00
Alex Vanin
90400d951a examples: add missing permission methods in manifests 2021-06-24 16:00:45 +03:00
Alex Vanin
5fa000cbae examples: rename onNEP11Transfer to onNEP11Payment in manifests
There is no such thing as `onNEP11Transfer` in NEP-11.
2021-06-23 20:48:04 +03:00
Anna Shaleva
39e096da64 examples: use base64 to encode HASHY token ID
Base58 does not preserve one-to-one byte correspondence with the
original data, so different combinations of the same number of bytes
might have different encoded string length. We use GAS transfer to mint
HASHY token, where the token hash is Base58Encode(Ripemd160(data + txHash)).

The problem is that `invokescript` RPC call is used to define transfer tx
sysfee, thus, txHash during testinvoke differs from the actual one, that's
why resulting token ID may have different length during testinvoke and
real invoke. As far as we use token ID as a key to store contract
values, the storage price may also differ. The result is failing
TestNEP11_OwnerOf_BalanceOf_Transfer test due to `gas limit exceeded`
error:

```
    logger.go:130: 2021-06-10T21:09:08.984+0300	WARN	contract invocation failed	{"tx": "45a0220b19725eaa0a4d01fa7a6cdaac8498592e8f3b43bdde27aae7d9ecf635", "block": 5, "error": "error encountered at instruction 36 (SYSCALL): error during call from native: error encountered at instruction 22 (SYSCALL): failed to invoke syscall 1736177434: gas limit exceeded"}
    executor_test.go:219:
        	Error Trace:	executor_test.go:219
        	            				nep11_test.go:132
        	            				nep11_test.go:235
        	Error:      	Not equal:
        	            	expected: 0x2
        	            	actual  : 0x4
        	Test:       	TestNEP11_OwnerOf_BalanceOf_Transfer
```

Fixed by using base64 instead of base58 (base64 preserves the resulting
encoded string length for the same input length).
2021-06-11 13:57:59 +03:00
Evgeniy Stratonikov
4467e2cbfd cli,compiler: allow to specify manifest permissions 2021-06-04 11:16:22 +03:00