@evvm/testnet-contracts 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +355 -55
  3. package/contracts/evvm/Evvm.sol +28 -31
  4. package/contracts/evvm/lib/ErrorsLib.sol +2 -1
  5. package/contracts/evvm/lib/EvvmStructs.sol +27 -1
  6. package/contracts/evvm/lib/SignatureUtils.sol +2 -5
  7. package/contracts/nameService/NameService.sol +118 -363
  8. package/contracts/nameService/lib/ErrorsLib.sol +1 -7
  9. package/contracts/nameService/lib/IdentityValidation.sol +182 -0
  10. package/contracts/nameService/lib/NameServiceStructs.sol +69 -0
  11. package/contracts/nameService/lib/SignatureUtils.sol +11 -4
  12. package/contracts/p2pSwap/P2PSwap.sol +41 -154
  13. package/contracts/p2pSwap/lib/P2PSwapStructs.sol +59 -0
  14. package/contracts/p2pSwap/lib/SignatureUtils.sol +1 -2
  15. package/contracts/staking/Estimator.sol +7 -6
  16. package/contracts/staking/Staking.sol +46 -146
  17. package/contracts/staking/lib/SignatureUtils.sol +1 -2
  18. package/contracts/staking/lib/StakingStructs.sol +94 -0
  19. package/contracts/treasury/Treasury.sol +18 -20
  20. package/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +88 -35
  21. package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +81 -47
  22. package/contracts/treasuryTwoChains/lib/ErrorsLib.sol +2 -0
  23. package/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +3 -14
  24. package/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +3 -7
  25. package/contracts/treasuryTwoChains/lib/SignatureUtils.sol +5 -7
  26. package/interfaces/IEstimator.sol +7 -50
  27. package/interfaces/IEvvm.sol +17 -91
  28. package/interfaces/INameService.sol +37 -88
  29. package/interfaces/IP2PSwap.sol +19 -15
  30. package/interfaces/IStaking.sol +20 -50
  31. package/interfaces/ITreasury.sol +1 -4
  32. package/interfaces/ITreasuryExternalChainStation.sol +11 -15
  33. package/interfaces/ITreasuryHostChainStation.sol +7 -10
  34. package/library/Erc191TestBuilder.sol +0 -1
  35. package/library/EvvmService.sol +14 -78
  36. package/library/primitives/IERC20.sol +79 -0
  37. package/library/utils/GovernanceUtils.sol +81 -0
  38. package/library/utils/{service/AsyncNonceService.sol → nonces/AsyncNonce.sol} +9 -11
  39. package/library/utils/nonces/SyncNonce.sol +27 -0
  40. package/library/utils/service/EvvmPayments.sol +77 -0
  41. package/library/utils/service/StakingServiceUtils.sol +15 -20
  42. package/package.json +11 -13
  43. package/library/utils/service/MakeServicePaymentOnEvvm.sol +0 -49
  44. package/library/utils/service/SyncNonceService.sol +0 -18
@@ -1,6 +1,5 @@
1
1
  // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
-
4
3
  pragma solidity ^0.8.0;
5
4
 
6
5
  interface IEstimator {
@@ -19,50 +18,21 @@ interface IEstimator {
19
18
  }
20
19
 
21
20
  function acceptActivatorProposal() external;
22
-
23
21
  function acceptAddressStakingProposal() external;
24
-
25
22
  function acceptAdminProposal() external;
26
-
27
23
  function acceptEvvmAddressProposal() external;
28
-
29
24
  function cancelActivatorProposal() external;
30
-
31
25
  function cancelAddressStakingProposal() external;
32
-
33
26
  function cancelAdminProposal() external;
34
-
35
27
  function cancelEvvmAddressProposal() external;
36
-
37
- function getActivatorMetadata()
38
- external
39
- view
40
- returns (AddressTypeProposal memory);
41
-
28
+ function getActivatorMetadata() external view returns (AddressTypeProposal memory);
42
29
  function getActualEpochInFormat() external view returns (bytes32);
43
-
44
30
  function getActualEpochInUint() external view returns (uint256);
45
-
46
- function getAddressStakingMetadata()
47
- external
48
- view
49
- returns (AddressTypeProposal memory);
50
-
51
- function getAdminMetadata()
52
- external
53
- view
54
- returns (AddressTypeProposal memory);
55
-
31
+ function getAddressStakingMetadata() external view returns (AddressTypeProposal memory);
32
+ function getAdminMetadata() external view returns (AddressTypeProposal memory);
56
33
  function getEpochMetadata() external view returns (EpochMetadata memory);
57
-
58
- function getEvvmAddressMetadata()
59
- external
60
- view
61
- returns (AddressTypeProposal memory);
62
-
63
- function makeEstimation(
64
- address _user
65
- )
34
+ function getEvvmAddressMetadata() external view returns (AddressTypeProposal memory);
35
+ function makeEstimation(address _user)
66
36
  external
67
37
  returns (
68
38
  bytes32 epochAnswer,
@@ -71,25 +41,12 @@ interface IEstimator {
71
41
  uint256 idToOverwrite,
72
42
  uint256 timestampToOverwrite
73
43
  );
74
-
75
- function notifyNewEpoch(
76
- address tokenPool,
77
- uint256 totalPool,
78
- uint256 totalStaked,
79
- uint256 tStart
80
- ) external;
81
-
44
+ function notifyNewEpoch(address tokenPool, uint256 totalPool, uint256 totalStaked, uint256 tStart) external;
82
45
  function setActivatorProposal(address _proposal) external;
83
-
84
46
  function setAddressStakingProposal(address _proposal) external;
85
-
86
47
  function setAdminProposal(address _proposal) external;
87
-
88
48
  function setEvvmAddressProposal(address _proposal) external;
89
-
90
- function simulteEstimation(
91
- address _user
92
- )
49
+ function simulteEstimation(address _user)
93
50
  external
94
51
  view
95
52
  returns (
@@ -1,6 +1,5 @@
1
1
  // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
-
4
3
  pragma solidity ^0.8.0;
5
4
 
6
5
  library EvvmStructs {
@@ -41,43 +40,29 @@ library EvvmStructs {
41
40
  }
42
41
 
43
42
  interface IEvvm {
43
+ error AsyncNonceAlreadyUsed();
44
44
  error InsufficientBalance();
45
45
  error InvalidAmount(uint256, uint256);
46
- error InvalidAsyncNonce();
47
46
  error InvalidSignature();
48
47
  error NotAnCA();
49
48
  error SenderIsNotTheExecutor();
50
49
  error SenderIsNotTreasury();
50
+ error SyncNonceMismatch();
51
51
  error UpdateBalanceFailed();
52
52
  error WindowToChangeEvvmIDExpired();
53
53
 
54
54
  fallback() external;
55
55
 
56
- function _setupNameServiceAndTreasuryAddress(
57
- address _nameServiceAddress,
58
- address _treasuryAddress
59
- ) external;
60
-
56
+ function _setupNameServiceAndTreasuryAddress(address _nameServiceAddress, address _treasuryAddress) external;
61
57
  function acceptAdmin() external;
62
-
63
58
  function acceptImplementation() external;
64
-
65
- function addAmountToUser(
66
- address user,
67
- address token,
68
- uint256 amount
69
- ) external;
70
-
59
+ function addAmountToUser(address user, address token, uint256 amount) external;
71
60
  function addBalance(address user, address token, uint256 quantity) external;
72
-
61
+ function payMultiple(EvvmStructs.PayData[] memory payData)
62
+ external
63
+ returns (uint256 successfulTransactions, bool[] memory results);
73
64
  function caPay(address to, address token, uint256 amount) external;
74
-
75
- function disperseCaPay(
76
- EvvmStructs.DisperseCaPayMetadata[] memory toData,
77
- address token,
78
- uint256 amount
79
- ) external;
80
-
65
+ function disperseCaPay(EvvmStructs.DisperseCaPayMetadata[] memory toData, address token, uint256 amount) external;
81
66
  function dispersePay(
82
67
  address from,
83
68
  EvvmStructs.DispersePayMetadata[] memory toData,
@@ -89,63 +74,28 @@ interface IEvvm {
89
74
  address executor,
90
75
  bytes memory signature
91
76
  ) external;
92
-
93
- function getBalance(
94
- address user,
95
- address token
96
- ) external view returns (uint256);
97
-
77
+ function getBalance(address user, address token) external view returns (uint256);
78
+ function getChainHostCoinAddress() external pure returns (address);
98
79
  function getCurrentAdmin() external view returns (address);
99
-
100
80
  function getCurrentImplementation() external view returns (address);
101
-
102
81
  function getEraPrincipalToken() external view returns (uint256);
103
-
104
82
  function getEvvmID() external view returns (uint256);
105
-
106
- function getEvvmMetadata()
107
- external
108
- view
109
- returns (EvvmStructs.EvvmMetadata memory);
110
-
111
- function getIfUsedAsyncNonce(
112
- address user,
113
- uint256 nonce
114
- ) external view returns (bool);
115
-
83
+ function getEvvmMetadata() external view returns (EvvmStructs.EvvmMetadata memory);
84
+ function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
116
85
  function getNameServiceAddress() external view returns (address);
117
-
118
- function getNextCurrentSyncNonce(
119
- address user
120
- ) external view returns (uint256);
121
-
122
- function getNextFisherDepositNonce(
123
- address user
124
- ) external view returns (uint256);
125
-
86
+ function getNextCurrentSyncNonce(address user) external view returns (uint256);
87
+ function getNextFisherDepositNonce(address user) external view returns (uint256);
88
+ function getPrincipalTokenAddress() external view returns (address);
126
89
  function getPrincipalTokenTotalSupply() external view returns (uint256);
127
-
128
90
  function getProposalAdmin() external view returns (address);
129
-
130
91
  function getProposalImplementation() external view returns (address);
131
-
132
92
  function getRewardAmount() external view returns (uint256);
133
-
134
93
  function getStakingContractAddress() external view returns (address);
135
-
136
94
  function getTimeToAcceptAdmin() external view returns (uint256);
137
-
138
95
  function getTimeToAcceptImplementation() external view returns (uint256);
139
-
140
96
  function getWhitelistTokenToBeAdded() external view returns (address);
141
-
142
- function getWhitelistTokenToBeAddedDateToSet()
143
- external
144
- view
145
- returns (uint256);
146
-
97
+ function getWhitelistTokenToBeAddedDateToSet() external view returns (uint256);
147
98
  function isAddressStaker(address user) external view returns (bool);
148
-
149
99
  function pay(
150
100
  address from,
151
101
  address to_address,
@@ -158,38 +108,14 @@ interface IEvvm {
158
108
  address executor,
159
109
  bytes memory signature
160
110
  ) external;
161
-
162
- function payMultiple(
163
- EvvmStructs.PayData[] memory payData
164
- )
165
- external
166
- returns (
167
- uint256 successfulTransactions,
168
- uint256 failedTransactions,
169
- bool[] memory results
170
- );
171
-
172
111
  function pointStaker(address user, bytes1 answer) external;
173
-
174
112
  function proposeAdmin(address _newOwner) external;
175
-
176
113
  function proposeImplementation(address _newImpl) external;
177
-
178
114
  function recalculateReward() external;
179
-
180
115
  function rejectProposalAdmin() external;
181
-
182
116
  function rejectUpgrade() external;
183
-
184
- function removeAmountFromUser(
185
- address user,
186
- address token,
187
- uint256 amount
188
- ) external;
189
-
117
+ function removeAmountFromUser(address user, address token, uint256 amount) external;
190
118
  function setEvvmID(uint256 newEvvmID) external;
191
-
192
119
  function setNameServiceAddress(address _nameServiceAddress) external;
193
-
194
120
  function setPointStaker(address user, bytes1 answer) external;
195
121
  }
@@ -1,22 +1,23 @@
1
1
  // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
+ pragma solidity ^0.8.0;
3
4
 
4
- pragma solidity ^0.8.4;
5
-
6
- interface NameService {
5
+ library NameServiceStructs {
7
6
  struct OfferMetadata {
8
7
  address offerer;
9
8
  uint256 expireDate;
10
9
  uint256 amount;
11
10
  }
11
+ }
12
12
 
13
+ interface INameService {
13
14
  error AcceptOfferVerificationFailed();
15
+ error AsyncNonceAlreadyUsed();
14
16
  error EmptyCustomMetadata();
15
17
  error FlushUsernameVerificationFailed();
16
18
  error InvalidKey();
17
19
  error InvalidSignatureOnNameService();
18
- error InvalidUsername(bytes1);
19
- error NonceAlreadyUsed();
20
+ error InvalidUsername();
20
21
  error PreRegistrationNotValid();
21
22
  error RenewUsernameVerificationFailed();
22
23
  error SenderIsNotAdmin();
@@ -51,10 +52,6 @@ interface NameService {
51
52
  function cancelChangeEvvmAddress() external;
52
53
  function cancelProposeAdmin() external;
53
54
  function cancelWithdrawPrincipalTokens() external;
54
- function checkIfNameServiceNonceIsAvailable(
55
- address _user,
56
- uint256 _nonce
57
- ) external view returns (bool);
58
55
  function claimWithdrawPrincipalTokens() external;
59
56
  function flushCustomMetadata(
60
57
  address user,
@@ -80,83 +77,43 @@ interface NameService {
80
77
  function getAdminFullDetails()
81
78
  external
82
79
  view
83
- returns (
84
- address currentAdmin,
85
- address proposalAdmin,
86
- uint256 timeToAcceptAdmin
87
- );
88
- function getAmountOfCustomMetadata(
89
- string memory _username
90
- ) external view returns (uint256);
91
- function getCustomMetadataMaxSlotsOfIdentity(
92
- string memory _username
93
- ) external view returns (uint256);
80
+ returns (address currentAdmin, address proposalAdmin, uint256 timeToAcceptAdmin);
81
+ function getAmountOfCustomMetadata(string memory _username) external view returns (uint256);
82
+ function getCustomMetadataMaxSlotsOfIdentity(string memory _username) external view returns (uint256);
94
83
  function getEvvmAddress() external view returns (address);
95
84
  function getEvvmAddressFullDetails()
96
85
  external
97
86
  view
98
- returns (
99
- address currentEvvmAddress,
100
- address proposalEvvmAddress,
101
- uint256 timeToAcceptEvvmAddress
102
- );
103
- function getExpireDateOfIdentity(
104
- string memory _identity
105
- ) external view returns (uint256);
106
- function getFullCustomMetadataOfIdentity(
107
- string memory _username
108
- ) external view returns (string[] memory);
109
- function getIdentityBasicMetadata(
110
- string memory _username
111
- ) external view returns (address, uint256);
112
- function getLengthOfOffersUsername(
113
- string memory _username
114
- ) external view returns (uint256 length);
115
- function getOffersOfUsername(
116
- string memory _username
117
- ) external view returns (OfferMetadata[] memory offers);
118
- function getOwnerOfIdentity(
119
- string memory _username
120
- ) external view returns (address);
121
- function getPriceOfRegistration(
122
- string memory username
123
- ) external view returns (uint256);
124
- function getPriceToAddCustomMetadata()
87
+ returns (address currentEvvmAddress, address proposalEvvmAddress, uint256 timeToAcceptEvvmAddress);
88
+ function getExpireDateOfIdentity(string memory _identity) external view returns (uint256);
89
+ function getFullCustomMetadataOfIdentity(string memory _username) external view returns (string[] memory);
90
+ function getIdentityBasicMetadata(string memory _username) external view returns (address, uint256);
91
+ function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
92
+ function getLengthOfOffersUsername(string memory _username) external view returns (uint256 length);
93
+ function getOffersOfUsername(string memory _username)
94
+ external
95
+ view
96
+ returns (NameServiceStructs.OfferMetadata[] memory offers);
97
+ function getOwnerOfIdentity(string memory _username) external view returns (address);
98
+ function getPriceOfRegistration(string memory username) external view returns (uint256);
99
+ function getPriceToAddCustomMetadata() external view returns (uint256 price);
100
+ function getPriceToFlushCustomMetadata(string memory _identity) external view returns (uint256 price);
101
+ function getPriceToFlushUsername(string memory _identity) external view returns (uint256 price);
102
+ function getPriceToRemoveCustomMetadata() external view returns (uint256 price);
103
+ function getProposedWithdrawAmountFullDetails()
125
104
  external
126
105
  view
127
- returns (uint256 price);
128
- function getPriceToFlushCustomMetadata(
129
- string memory _identity
130
- ) external view returns (uint256 price);
131
- function getPriceToFlushUsername(
132
- string memory _identity
133
- ) external view returns (uint256 price);
134
- function getPriceToRemoveCustomMetadata()
106
+ returns (uint256 proposalAmountToWithdrawTokens, uint256 timeToAcceptAmountToWithdrawTokens);
107
+ function getSingleCustomMetadataOfIdentity(string memory _username, uint256 _key)
135
108
  external
136
109
  view
137
- returns (uint256 price);
138
- function getProposedWithdrawAmountFullDetails()
110
+ returns (string memory);
111
+ function getSingleOfferOfUsername(string memory _username, uint256 _offerID)
139
112
  external
140
113
  view
141
- returns (
142
- uint256 proposalAmountToWithdrawTokens,
143
- uint256 timeToAcceptAmountToWithdrawTokens
144
- );
145
- function getSingleCustomMetadataOfIdentity(
146
- string memory _username,
147
- uint256 _key
148
- ) external view returns (string memory);
149
- function getSingleOfferOfUsername(
150
- string memory _username,
151
- uint256 _offerID
152
- ) external view returns (OfferMetadata memory offer);
153
- function hashUsername(
154
- string memory _username,
155
- uint256 _randomNumber
156
- ) external pure returns (bytes32);
157
- function isUsernameAvailable(
158
- string memory _username
159
- ) external view returns (bool);
114
+ returns (NameServiceStructs.OfferMetadata memory offer);
115
+ function hashUsername(string memory _username, uint256 _randomNumber) external pure returns (bytes32);
116
+ function isUsernameAvailable(string memory _username) external view returns (bool);
160
117
  function makeOffer(
161
118
  address user,
162
119
  string memory username,
@@ -214,18 +171,10 @@ interface NameService {
214
171
  bool priorityFlag_EVVM,
215
172
  bytes memory signature_EVVM
216
173
  ) external;
217
- function seePriceToRenew(
218
- string memory _identity
219
- ) external view returns (uint256 price);
220
- function strictVerifyIfIdentityExist(
221
- string memory _username
222
- ) external view returns (bool);
223
- function verifyIfIdentityExists(
224
- string memory _identity
225
- ) external view returns (bool);
226
- function verifyStrictAndGetOwnerOfIdentity(
227
- string memory _username
228
- ) external view returns (address answer);
174
+ function seePriceToRenew(string memory _identity) external view returns (uint256 price);
175
+ function strictVerifyIfIdentityExist(string memory _username) external view returns (bool);
176
+ function verifyIfIdentityExists(string memory _identity) external view returns (bool);
177
+ function verifyStrictAndGetOwnerOfIdentity(string memory _username) external view returns (address answer);
229
178
  function withdrawOffer(
230
179
  address user,
231
180
  string memory username,
@@ -1,9 +1,8 @@
1
1
  // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
+ pragma solidity ^0.8.0;
3
4
 
4
- pragma solidity ^0.8.4;
5
-
6
- interface P2PSwap {
5
+ library P2PSwapStructs {
7
6
  struct MarketInformation {
8
7
  address tokenA;
9
8
  address tokenB;
@@ -55,6 +54,11 @@ interface P2PSwap {
55
54
  uint256 service;
56
55
  uint256 mateStaker;
57
56
  }
57
+ }
58
+
59
+ interface IP2PSwap {
60
+ error AsyncNonceAlreadyUsed();
61
+ error InvalidServiceSignature();
58
62
 
59
63
  function acceptFillFixedPercentage() external;
60
64
  function acceptFillPropotionalPercentage() external;
@@ -65,16 +69,15 @@ interface P2PSwap {
65
69
  function addBalance(address _token, uint256 _amount) external;
66
70
  function cancelOrder(
67
71
  address user,
68
- MetadataCancelOrder memory metadata,
72
+ P2PSwapStructs.MetadataCancelOrder memory metadata,
69
73
  uint256 _priorityFee_Evvm,
70
74
  uint256 _nonce_Evvm,
71
75
  bool _priority_Evvm,
72
76
  bytes memory _signature_Evvm
73
77
  ) external;
74
- function checkIfANonceP2PSwapIsUsed(address user, uint256 nonce) external view returns (bool);
75
78
  function dispatchOrder_fillFixedFee(
76
79
  address user,
77
- MetadataDispatchOrder memory metadata,
80
+ P2PSwapStructs.MetadataDispatchOrder memory metadata,
78
81
  uint256 _priorityFee_Evvm,
79
82
  uint256 _nonce_Evvm,
80
83
  bool _priority_Evvm,
@@ -83,35 +86,36 @@ interface P2PSwap {
83
86
  ) external;
84
87
  function dispatchOrder_fillPropotionalFee(
85
88
  address user,
86
- MetadataDispatchOrder memory metadata,
89
+ P2PSwapStructs.MetadataDispatchOrder memory metadata,
87
90
  uint256 _priorityFee_Evvm,
88
91
  uint256 _nonce_Evvm,
89
92
  bool _priority_Evvm,
90
93
  bytes memory _signature_Evvm
91
94
  ) external;
92
95
  function findMarket(address tokenA, address tokenB) external view returns (uint256);
93
- function getAllMarketOrders(uint256 market) external view returns (OrderForGetter[] memory orders);
94
- function getAllMarketsMetadata() external view returns (MarketInformation[] memory);
96
+ function getAllMarketOrders(uint256 market) external view returns (P2PSwapStructs.OrderForGetter[] memory orders);
97
+ function getAllMarketsMetadata() external view returns (P2PSwapStructs.MarketInformation[] memory);
95
98
  function getBalanceOfContract(address token) external view returns (uint256);
96
- function getMarketMetadata(uint256 market) external view returns (MarketInformation memory);
99
+ function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
100
+ function getMarketMetadata(uint256 market) external view returns (P2PSwapStructs.MarketInformation memory);
97
101
  function getMaxLimitFillFixedFee() external view returns (uint256);
98
102
  function getMaxLimitFillFixedFeeProposal() external view returns (uint256);
99
103
  function getMyOrdersInSpecificMarket(address user, uint256 market)
100
104
  external
101
105
  view
102
- returns (OrderForGetter[] memory orders);
103
- function getOrder(uint256 market, uint256 orderId) external view returns (Order memory order);
106
+ returns (P2PSwapStructs.OrderForGetter[] memory orders);
107
+ function getOrder(uint256 market, uint256 orderId) external view returns (P2PSwapStructs.Order memory order);
104
108
  function getOwner() external view returns (address);
105
109
  function getOwnerProposal() external view returns (address);
106
110
  function getOwnerTimeToAccept() external view returns (uint256);
107
111
  function getPercentageFee() external view returns (uint256);
108
112
  function getProposalPercentageFee() external view returns (uint256);
109
113
  function getProposedWithdrawal() external view returns (address, uint256, address, uint256);
110
- function getRewardPercentage() external view returns (Percentage memory);
111
- function getRewardPercentageProposal() external view returns (Percentage memory);
114
+ function getRewardPercentage() external view returns (P2PSwapStructs.Percentage memory);
115
+ function getRewardPercentageProposal() external view returns (P2PSwapStructs.Percentage memory);
112
116
  function makeOrder(
113
117
  address user,
114
- MetadataMakeOrder memory metadata,
118
+ P2PSwapStructs.MetadataMakeOrder memory metadata,
115
119
  bytes memory signature,
116
120
  uint256 _priorityFee_Evvm,
117
121
  uint256 _nonce_Evvm,
@@ -1,9 +1,8 @@
1
1
  // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
+ pragma solidity ^0.8.0;
3
4
 
4
- pragma solidity ^0.8.4;
5
-
6
- interface IStaking {
5
+ library StakingStructs {
7
6
  struct BoolTypeProposal {
8
7
  bool flag;
9
8
  uint256 timeToAccept;
@@ -15,18 +14,20 @@ interface IStaking {
15
14
  uint256 timestamp;
16
15
  uint256 totalStaked;
17
16
  }
17
+ }
18
18
 
19
+ interface IStaking {
19
20
  error AddressIsNotAService();
20
21
  error AddressMismatch();
21
22
  error AddressMustWaitToFullUnstake();
22
23
  error AddressMustWaitToStakeAgain();
24
+ error AsyncNonceAlreadyUsed();
23
25
  error InvalidSignatureOnStaking();
24
26
  error PresaleStakingDisabled();
25
27
  error SenderIsNotAdmin();
26
28
  error SenderIsNotGoldenFisher();
27
29
  error ServiceDoesNotFulfillCorrectStakingAmount(uint256 requiredAmount);
28
30
  error ServiceDoesNotStakeInSameTx();
29
- error StakingNonceAlreadyUsed();
30
31
  error UserIsNotPresaleStaker();
31
32
  error UserPresaleStakerLimitExceeded();
32
33
 
@@ -40,57 +41,34 @@ interface IStaking {
40
41
  function cancelChangeAllowPresaleStaking() external;
41
42
  function cancelChangeAllowPublicStaking() external;
42
43
  function cancelSetSecondsToUnllockFullUnstaking() external;
43
- function checkIfStakeNonceUsed(
44
- address _account,
45
- uint256 _nonce
46
- ) external view returns (bool);
47
44
  function confirmChangeAllowPresaleStaking() external;
48
45
  function confirmChangeAllowPublicStaking() external;
49
46
  function confirmServiceStaking() external;
50
47
  function confirmSetSecondsToUnllockFullUnstaking() external;
51
- function getAddressHistory(
52
- address _account
53
- ) external view returns (HistoryMetadata[] memory);
54
- function getAddressHistoryByIndex(
55
- address _account,
56
- uint256 _index
57
- ) external view returns (HistoryMetadata memory);
58
- function getAllDataOfAllowPublicStaking()
59
- external
60
- view
61
- returns (BoolTypeProposal memory);
62
- function getAllowPresaleStaking()
48
+ function getAddressHistory(address _account) external view returns (StakingStructs.HistoryMetadata[] memory);
49
+ function getAddressHistoryByIndex(address _account, uint256 _index)
63
50
  external
64
51
  view
65
- returns (BoolTypeProposal memory);
52
+ returns (StakingStructs.HistoryMetadata memory);
53
+ function getAllDataOfAllowPublicStaking() external view returns (StakingStructs.BoolTypeProposal memory);
54
+ function getAllowPresaleStaking() external view returns (StakingStructs.BoolTypeProposal memory);
66
55
  function getEstimatorAddress() external view returns (address);
67
56
  function getEstimatorProposal() external view returns (address);
68
57
  function getEvvmAddress() external view returns (address);
69
58
  function getGoldenFisher() external view returns (address);
70
59
  function getGoldenFisherProposal() external view returns (address);
60
+ function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
71
61
  function getMateAddress() external pure returns (address);
72
62
  function getOwner() external view returns (address);
73
- function getPresaleStaker(
74
- address _account
75
- ) external view returns (bool, uint256);
63
+ function getPresaleStaker(address _account) external view returns (bool, uint256);
76
64
  function getPresaleStakerCount() external view returns (uint256);
77
65
  function getSecondsToUnlockFullUnstaking() external view returns (uint256);
78
66
  function getSecondsToUnlockStaking() external view returns (uint256);
79
- function getSizeOfAddressHistory(
80
- address _account
81
- ) external view returns (uint256);
82
- function getTimeToUserUnlockFullUnstakingTime(
83
- address _account
84
- ) external view returns (uint256);
85
- function getTimeToUserUnlockStakingTime(
86
- address _account
87
- ) external view returns (uint256);
88
- function getUserAmountStaked(
89
- address _account
90
- ) external view returns (uint256);
91
- function gimmeYiel(
92
- address user
93
- )
67
+ function getSizeOfAddressHistory(address _account) external view returns (uint256);
68
+ function getTimeToUserUnlockFullUnstakingTime(address _account) external view returns (uint256);
69
+ function getTimeToUserUnlockStakingTime(address _account) external view returns (uint256);
70
+ function getUserAmountStaked(address _account) external view returns (uint256);
71
+ function gimmeYiel(address user)
94
72
  external
95
73
  returns (
96
74
  bytes32 epochAnswer,
@@ -99,17 +77,11 @@ interface IStaking {
99
77
  uint256 idToOverwriteUserHistory,
100
78
  uint256 timestampToBeOverwritten
101
79
  );
102
- function goldenStaking(
103
- bool isStaking,
104
- uint256 amountOfStaking,
105
- bytes memory signature_EVVM
106
- ) external;
80
+ function goldenStaking(bool isStaking, uint256 amountOfStaking, bytes memory signature_EVVM) external;
107
81
  function prepareChangeAllowPresaleStaking() external;
108
82
  function prepareChangeAllowPublicStaking() external;
109
83
  function prepareServiceStaking(uint256 amountOfStaking) external;
110
- function prepareSetSecondsToUnllockFullUnstaking(
111
- uint256 _secondsToUnllockFullUnstaking
112
- ) external;
84
+ function prepareSetSecondsToUnllockFullUnstaking(uint256 _secondsToUnllockFullUnstaking) external;
113
85
  function presaleStaking(
114
86
  address user,
115
87
  bool isStaking,
@@ -124,9 +96,7 @@ interface IStaking {
124
96
  function proposeAdmin(address _newAdmin) external;
125
97
  function proposeEstimator(address _estimator) external;
126
98
  function proposeGoldenFisher(address _goldenFisher) external;
127
- function proposeSetSecondsToUnlockStaking(
128
- uint256 _secondsToUnlockStaking
129
- ) external;
99
+ function proposeSetSecondsToUnlockStaking(uint256 _secondsToUnlockStaking) external;
130
100
  function publicStaking(
131
101
  address user,
132
102
  bool isStaking,
@@ -1,6 +1,5 @@
1
1
  // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
-
4
3
  pragma solidity ^0.8.0;
5
4
 
6
5
  interface ITreasury {
@@ -10,8 +9,6 @@ interface ITreasury {
10
9
  error PrincipalTokenIsNotWithdrawable();
11
10
 
12
11
  function deposit(address token, uint256 amount) external payable;
13
-
14
- function evvmAddress() external view returns (address);
15
-
12
+ function getEvvmAddress() external view returns (address);
16
13
  function withdraw(address token, uint256 amount) external;
17
14
  }