Commit graph

300 commits

Author SHA1 Message Date
Alex Vanin
bf391b57dd [#18] Add sidechain contracts
Sidechain contracts include alphabet contracts for governance
and audit, balance, container, neofsid, netmap, reputation
contracts.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-27 17:33:56 +03:00
Alex Vanin
dab74aeec7 [#18] Ignore contracts config.json files
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-27 17:33:56 +03:00
Alex Vanin
df27e859c9 [#18] Move neofs contract to separate dir
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-27 17:33:56 +03:00
Alex Vanin
6a881a2baa Set max amount for Withdraw and Deposit methods
These methods initiate `transfer` call on internal
balance method that have Fixed12 precision. With this
limit it will not overflow JSON integer bound 2**53-1

Actual limit is 9007, but it was floored.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-26 18:26:04 +03:00
Alex Vanin
332e1ceca9 [#16] Verify initial inner ring size and keys
closes #16

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-09-17 19:09:50 +03:00
Alex Vanin
33802137ee [#15] Specify type of interface typed arguments
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
Alex Vanin
47eb73ad67 [#15] Update native gas script hash
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
Alex Vanin
ff83e7fe78 [#15] Fix AppCall invocations
There is no need in single array for all arguments now.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
Alex Vanin
a2479a3ade [#15] Add notifications list in config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
Alex Vanin
9041bb77d4 [#15] Update inline docs
Since all contract methods have separated function,
method descriptions were moved from global comment
section to the function definitions (go-way).

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
Alex Vanin
d75c11c897 [#15] Check amount value in withdraw method
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
Alex Vanin
7a275a3c4b [#15] Refactor contract body for neo-go v0.91
In neo-go v0.91.0 manifest file should contain info
about all contract methods. To do that neo-go compiler
uses public function defined in contract file. This
commit splits entire Main function into smaller
independent contract methods.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
Alex Vanin
da3c75465b [#15] Update neo-go to v0.91.0
Neo-go v0.91.0 supports neo3-preview-3.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-08-28 09:55:02 +03:00
alexvanin
751daf328b Merge branch 'release/0.2.0' 2020-07-23 21:14:35 +03:00
Alex Vanin
5c2d82a0b6
Merge pull request #14 from nspcc-dev/neo3/docs
Remove unused functions and update docs
2020-07-21 18:23:16 +03:00
alexvanin
8460ab01e4 Remove tests and update readme file 2020-07-21 12:42:14 +03:00
alexvanin
013a70f3bf Remove unused functions and fix lint errors 2020-07-21 12:42:14 +03:00
Alex Vanin
1cfbd19e9e
Merge pull request #13 from nspcc-dev/neo3/config
Add neofs install configuration
2020-07-21 12:40:38 +03:00
alexvanin
8c7bcea436 Add system config methods
NeoFS contract will contain installation parameters
for storage network such as max object size, epoch
duration, etc.
2020-07-21 12:39:22 +03:00
Alex Vanin
058e39dcf1
Merge pull request #12 from nspcc-dev/neo3/ir-candidates
Update inner ring candidate methods
2020-07-20 14:49:26 +03:00
alexvanin
7a806bd550 Update "InnerRingUpdate" method 2020-07-16 17:54:06 +03:00
alexvanin
abdbe6b9dc Update methods for inner ring candidate managing
This commit:
- increases default candidate fee,
- adds function to list inner ring candidates,
- updates add and remove candidate methods.
2020-07-16 15:09:54 +03:00
Alex Vanin
f5d2e96063
Merge pull request #11 from nspcc-dev/neo3/bind
Add "Bind" and "Unbind" methods
2020-07-16 14:11:49 +03:00
alexvanin
8ef70e70d7 Add "Bind" and "Unbind" methods
New methods allow to bind and unbind public keys
with the owner, therefore the user can store and
access data with the key, that does not related
to the wallet.
2020-07-16 12:50:24 +03:00
Alex Vanin
f33622d155
Merge pull request #10 from nspcc-dev/neo3/init-deposit-withdraw
Update Deploy, Deposit, Withdraw and Cheque methods
2020-07-16 12:33:43 +03:00
alexvanin
6797c7c1a7 Update "Cheque" method 2020-07-16 10:49:41 +03:00
alexvanin
62d5d863f4 Rename "Deploy" method to "Init"
There was a bit of confusion between contract deploying
and calling "Deploy" method. Also new "Init" method
uses generic setter to initialize contract storage.
2020-07-15 20:00:05 +03:00
alexvanin
209740f060 Use generic setter and type defined getters
With NEO3.0 there is a null pointers in VM, so we
can use it to check if value was stored in cotnract
storage or not.
2020-07-15 19:58:31 +03:00
alexvanin
2f86e8f5d0 Rename check structure to cheque
Cheque is widely used in neofs as a definition
of structure that connected with configuration
changing or asset withdraw. This name is used
to avoid confusion with 'check' with
verification meaning.
2020-07-15 19:57:14 +03:00
alexvanin
bf8b6f91d7 Fix withdraw log message 2020-07-15 19:55:10 +03:00
alexvanin
ca54f71d30 Update "Deposit" method
Deposit method now takes script hashes instead of public keys and
uses native gas token.
2020-07-15 19:02:40 +03:00
alexvanin
62ba54e88e Update neo-go to v0.90.0 and Makefile 2020-07-15 11:47:29 +03:00
Alex Vanin
5a3bdf917d
Merge pull request #9 from nspcc-dev/neo3
Update neo-go to v0.90.0-pre and fix smart-contract
2020-07-15 11:43:01 +03:00
alexvanin
b9ca56d891 Update neo-go to v0.90.0-pre and fix smart-contract
Neo-go v0.90.0-pre implements neo3 features.
2020-07-09 16:38:53 +03:00
Alex Vanin
94d44953e5
Merge pull request #8 from nspcc-dev/fix/uniq-invocations
Limit ballot lifetime and store unique inner ring invocations
2020-06-19 13:44:08 +03:00
alexvanin
f10d346925 Fix tests for unique inner ring invoke checker 2020-06-19 13:40:09 +03:00
alexvanin
dc84dde87b Limit ballot lifetime and store unique inner ring invocations 2020-06-15 18:54:24 +03:00
alexvanin
2efabc95c2 Check tx hash in notification assert
To compile contract in test environment there are
two more mocks for GetScriptContainer and GetHash
interops.
2020-06-15 13:32:13 +03:00
alexvanin
19db32b654 Add tx hash for "Deposit" and "Withdraw" notifications
As the user can invoke several deposit or withdraw calls
inner ring nodes should be able to differ them even if they
have the same arguments. To do that neofs-contract notifies
about tx hash, which can be used as unique identifier of
withdraw or deposit operation.
2020-06-15 13:32:13 +03:00
alexvanin
2f3cfee6ae Update neo-go library to v0.75.0
This commit updates neo-go library and adds notification
check for "Deposit", "Withdraw" and "Cheque" methods.
2020-06-15 13:32:13 +03:00
alexvanin
893de17372 Update tests for new withdraw mechanism 2020-06-15 13:32:13 +03:00
alexvanin
cb00b6133e Update withdraw mechanism
Withdraw operation works a bit different with neo:morph.
User calls "Deposit" and "Withdraw" methods that produce
notifications for the inner ring nodes.

"Deposit" method does not produce feedback, but "Withdraw"
does. Inner ring nodes check if user eligible to withdraw
assets. If so, nodes invoke "Cheque" method. This method
collects invocations from inner ring nods. When there are
2/3n + 1 invocations, smart-contract transfers assets back
to the user and produces notifications.
2020-06-15 13:32:13 +03:00
alexvanin
88e73a04d7 Remove inner ring update test
This test runs in neofs-node repository because it uses internal
neofs-node structures. It will be reworked later.
2020-06-15 13:32:13 +03:00
alexvanin
4fbfa1bc98 Collect "InnerRingUpdate" calls from inner ring nodes
Inner ring nodes do not collect signatures for the cheque now.
Instead they invoke "InnerRingUpdate" method and smart-contract
checks if method was called from inner ring node. Then it
accepts cheque if there were 2/3n+1 invokes.
2020-06-15 13:32:13 +03:00
alexvanin
78b8af8f83 Do not store multiaddress of inner ring nodes
With neo:morph environment, there will be no direct communication
between inner ring nodes and storage nodes. neo:morph smart-contracts
will identify inner ring nodes by their signatures.
2020-06-15 13:32:13 +03:00
alexvanin
9f33939dee Add "IsInnerRing" method
Inner ring nodes check their presence in inner ring list during
startup. "IsInnerRing" method allows to check presence efficiently
by calling this method.
2020-06-15 13:32:13 +03:00
anastasia prasolova
d97a4a9955 added yaml config for contract deployment 2020-06-09 13:52:32 +03:00
Alex Vanin
35656b0661
Merge pull request #1 from nspcc-dev/use-loop-labels
Use loop label in InnerRingUpdate call handler
2020-05-20 13:04:45 +03:00
Leonard Lyubich
9a51b508e8 Use loop label in InnerRingUpdate call handler 2020-05-20 12:38:11 +03:00
alexvanin
859c29c8df init commit 2020-04-01 19:27:29 +03:00