@evvm/testnet-contracts 2.3.0 → 3.0.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 (67) hide show
  1. package/README.md +44 -24
  2. package/contracts/core/Core.sol +1392 -0
  3. package/contracts/core/lib/CoreStorage.sol +171 -0
  4. package/contracts/nameService/NameService.sol +613 -543
  5. package/contracts/nameService/lib/IdentityValidation.sol +15 -21
  6. package/contracts/p2pSwap/P2PSwap.sol +258 -145
  7. package/contracts/staking/Estimator.sol +25 -44
  8. package/contracts/staking/Staking.sol +284 -262
  9. package/contracts/treasury/Treasury.sol +40 -47
  10. package/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +585 -198
  11. package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +425 -174
  12. package/contracts/treasuryTwoChains/lib/PayloadUtils.sol +2 -4
  13. package/interfaces/{IEvvm.sol → ICore.sol} +58 -25
  14. package/interfaces/IEstimator.sol +1 -1
  15. package/interfaces/INameService.sol +46 -49
  16. package/interfaces/IP2PSwap.sol +16 -17
  17. package/interfaces/IStaking.sol +21 -17
  18. package/interfaces/ITreasury.sol +2 -1
  19. package/interfaces/ITreasuryExternalChainStation.sol +15 -9
  20. package/interfaces/ITreasuryHostChainStation.sol +14 -11
  21. package/interfaces/IUserValidator.sol +6 -0
  22. package/library/Erc191TestBuilder.sol +336 -471
  23. package/library/EvvmService.sol +27 -71
  24. package/library/errors/CoreError.sol +116 -0
  25. package/library/errors/CrossChainTreasuryError.sol +36 -0
  26. package/library/errors/NameServiceError.sol +79 -0
  27. package/library/errors/StakingError.sol +79 -0
  28. package/{contracts/treasury/lib/ErrorsLib.sol → library/errors/TreasuryError.sol} +9 -17
  29. package/library/structs/CoreStructs.sol +146 -0
  30. package/library/structs/ExternalChainStationStructs.sol +92 -0
  31. package/library/structs/HostChainStationStructs.sol +77 -0
  32. package/library/structs/NameServiceStructs.sol +47 -0
  33. package/library/structs/P2PSwapStructs.sol +127 -0
  34. package/library/structs/StakingStructs.sol +67 -0
  35. package/library/utils/AdvancedStrings.sol +62 -44
  36. package/library/utils/CAUtils.sol +29 -0
  37. package/library/utils/governance/Admin.sol +66 -0
  38. package/library/utils/governance/ProposalStructs.sol +49 -0
  39. package/library/utils/service/CoreExecution.sol +158 -0
  40. package/library/utils/service/StakingServiceUtils.sol +20 -37
  41. package/library/utils/signature/CoreHashUtils.sol +73 -0
  42. package/library/utils/signature/NameServiceHashUtils.sol +156 -0
  43. package/library/utils/signature/P2PSwapHashUtils.sol +65 -0
  44. package/library/utils/signature/StakingHashUtils.sol +41 -0
  45. package/library/utils/signature/TreasuryCrossChainHashUtils.sol +40 -0
  46. package/package.json +1 -1
  47. package/contracts/evvm/Evvm.sol +0 -1300
  48. package/contracts/evvm/lib/ErrorsLib.sol +0 -131
  49. package/contracts/evvm/lib/EvvmStorage.sol +0 -217
  50. package/contracts/evvm/lib/EvvmStructs.sol +0 -208
  51. package/contracts/evvm/lib/SignatureUtils.sol +0 -162
  52. package/contracts/nameService/lib/ErrorsLib.sol +0 -155
  53. package/contracts/nameService/lib/NameServiceStructs.sol +0 -125
  54. package/contracts/nameService/lib/SignatureUtils.sol +0 -420
  55. package/contracts/p2pSwap/lib/P2PSwapStructs.sol +0 -59
  56. package/contracts/p2pSwap/lib/SignatureUtils.sol +0 -98
  57. package/contracts/staking/lib/ErrorsLib.sol +0 -98
  58. package/contracts/staking/lib/SignatureUtils.sol +0 -105
  59. package/contracts/staking/lib/StakingStructs.sol +0 -106
  60. package/contracts/treasuryTwoChains/lib/ErrorsLib.sol +0 -48
  61. package/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +0 -80
  62. package/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +0 -87
  63. package/contracts/treasuryTwoChains/lib/SignatureUtils.sol +0 -79
  64. package/library/utils/GovernanceUtils.sol +0 -81
  65. package/library/utils/nonces/AsyncNonce.sol +0 -74
  66. package/library/utils/nonces/SyncNonce.sol +0 -71
  67. package/library/utils/service/EvvmPayments.sol +0 -144
@@ -5,10 +5,8 @@ pragma solidity ^0.8.0;
5
5
  /**
6
6
  * @title PayloadUtils Library
7
7
  * @author Mate labs
8
- * @notice Utility library for encoding and decoding cross-chain transfer payloads
9
- * @dev Provides standardized payload format for cross-chain treasury operations
10
- * Used by both TreasuryHostChainStation and TreasuryExternalChainStation
11
- * to ensure consistent data format across Hyperlane, LayerZero, and Axelar protocols
8
+ * @notice Utility library for encoding/decoding cross-chain transfer payloads
9
+ * @dev Standardized payload format (ABI encoding) for TreasuryHostChainStation and TreasuryExternalChainStation. Used across Hyperlane, LayerZero, Axelar.
12
10
  */
13
11
  library PayloadUtils {
14
12
  /// @notice Encodes transfer data into a standardized cross-chain payload
@@ -2,7 +2,20 @@
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
3
  pragma solidity ^0.8.0;
4
4
 
5
- library EvvmStructs {
5
+ library CoreStructs {
6
+ struct BatchData {
7
+ address from;
8
+ address to_address;
9
+ string to_identity;
10
+ address token;
11
+ uint256 amount;
12
+ uint256 priorityFee;
13
+ address senderExecutor;
14
+ uint256 nonce;
15
+ bool isAsyncExec;
16
+ bytes signature;
17
+ }
18
+
6
19
  struct DisperseCaPayMetadata {
7
20
  uint256 amount;
8
21
  address toAddress;
@@ -24,66 +37,75 @@ library EvvmStructs {
24
37
  uint256 eraTokens;
25
38
  uint256 reward;
26
39
  }
40
+ }
27
41
 
28
- struct PayData {
29
- address from;
30
- address to_address;
31
- string to_identity;
32
- address token;
33
- uint256 amount;
34
- uint256 priorityFee;
35
- uint256 nonce;
36
- bool priorityFlag;
37
- address executor;
38
- bytes signature;
42
+ library ProposalStructs {
43
+ struct AddressTypeProposal {
44
+ address current;
45
+ address proposal;
46
+ uint256 timeToAccept;
39
47
  }
40
48
  }
41
49
 
42
- interface IEvvm {
50
+ interface ICore {
43
51
  error AddressCantBeZero();
52
+ error AsyncNonceAlreadyReserved();
44
53
  error AsyncNonceAlreadyUsed();
54
+ error AsyncNonceIsReservedByAnotherService();
55
+ error AsyncNonceNotReserved();
45
56
  error BreakerExploded();
46
57
  error ImplementationIsNotActive();
47
58
  error IncorrectAddressInput();
48
59
  error InsufficientBalance();
49
60
  error InvalidAmount();
61
+ error InvalidServiceAddress();
50
62
  error InvalidSignature();
63
+ error MsgSenderIsNotAContract();
51
64
  error NotAnCA();
65
+ error OriginIsNotTheOriginExecutor();
66
+ error ProposalForUserValidatorNotReady();
52
67
  error SenderIsNotAdmin();
53
- error SenderIsNotTheExecutor();
54
68
  error SenderIsNotTheProposedAdmin();
69
+ error SenderIsNotTheSenderExecutor();
55
70
  error SenderIsNotTreasury();
56
71
  error SyncNonceMismatch();
57
72
  error TimeLockNotExpired();
73
+ error UserCannotExecuteTransaction();
58
74
  error WindowExpired();
59
75
 
60
76
  fallback() external;
61
77
 
62
- function _setupNameServiceAndTreasuryAddress(address _nameServiceAddress, address _treasuryAddress) external;
63
78
  function acceptAdmin() external;
64
79
  function acceptImplementation() external;
80
+ function acceptUserValidatorProposal() external;
65
81
  function addAmountToUser(address user, address token, uint256 amount) external;
66
82
  function addBalance(address user, address token, uint256 quantity) external;
83
+ function asyncNonceStatus(address user, uint256 nonce) external view returns (bytes1);
84
+ function batchPay(CoreStructs.BatchData[] memory batchData)
85
+ external
86
+ returns (uint256 successfulTransactions, bool[] memory results);
67
87
  function caPay(address to, address token, uint256 amount) external;
68
- function disperseCaPay(EvvmStructs.DisperseCaPayMetadata[] memory toData, address token, uint256 amount) external;
88
+ function cancelUserValidatorProposal() external;
89
+ function disperseCaPay(CoreStructs.DisperseCaPayMetadata[] memory toData, address token, uint256 amount) external;
69
90
  function dispersePay(
70
91
  address from,
71
- EvvmStructs.DispersePayMetadata[] memory toData,
92
+ CoreStructs.DispersePayMetadata[] memory toData,
72
93
  address token,
73
94
  uint256 amount,
74
95
  uint256 priorityFee,
96
+ address senderExecutor,
75
97
  uint256 nonce,
76
- bool priorityFlag,
77
- address executor,
98
+ bool isAsyncExec,
78
99
  bytes memory signature
79
100
  ) external;
101
+ function getAsyncNonceReservation(address user, uint256 nonce) external view returns (address);
80
102
  function getBalance(address user, address token) external view returns (uint256);
81
103
  function getChainHostCoinAddress() external pure returns (address);
82
104
  function getCurrentAdmin() external view returns (address);
83
105
  function getCurrentImplementation() external view returns (address);
84
106
  function getEraPrincipalToken() external view returns (uint256);
85
107
  function getEvvmID() external view returns (uint256);
86
- function getEvvmMetadata() external view returns (EvvmStructs.EvvmMetadata memory);
108
+ function getEvvmMetadata() external view returns (CoreStructs.EvvmMetadata memory);
87
109
  function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
88
110
  function getNameServiceAddress() external view returns (address);
89
111
  function getNextCurrentSyncNonce(address user) external view returns (uint256);
@@ -96,8 +118,11 @@ interface IEvvm {
96
118
  function getStakingContractAddress() external view returns (address);
97
119
  function getTimeToAcceptAdmin() external view returns (uint256);
98
120
  function getTimeToAcceptImplementation() external view returns (uint256);
121
+ function getUserValidatorAddress() external view returns (address);
122
+ function getUserValidatorAddressDetails() external view returns (ProposalStructs.AddressTypeProposal memory);
99
123
  function getWhitelistTokenToBeAdded() external view returns (address);
100
124
  function getWhitelistTokenToBeAddedDateToSet() external view returns (uint256);
125
+ function initializeSystemContracts(address _nameServiceAddress, address _treasuryAddress) external;
101
126
  function isAddressStaker(address user) external view returns (bool);
102
127
  function pay(
103
128
  address from,
@@ -106,21 +131,29 @@ interface IEvvm {
106
131
  address token,
107
132
  uint256 amount,
108
133
  uint256 priorityFee,
134
+ address senderExecutor,
109
135
  uint256 nonce,
110
- bool priorityFlag,
111
- address executor,
136
+ bool isAsyncExec,
112
137
  bytes memory signature
113
138
  ) external;
114
- function payMultiple(EvvmStructs.PayData[] memory payData)
115
- external
116
- returns (uint256 successfulTransactions, bool[] memory results);
117
139
  function pointStaker(address user, bytes1 answer) external;
118
140
  function proposeAdmin(address _newOwner) external;
119
141
  function proposeImplementation(address _newImpl) external;
142
+ function proposeUserValidator(address newValidator) external;
120
143
  function recalculateReward() external;
121
144
  function rejectProposalAdmin() external;
122
145
  function rejectUpgrade() external;
123
146
  function removeAmountFromUser(address user, address token, uint256 amount) external;
147
+ function reserveAsyncNonce(uint256 nonce, address serviceAddress) external;
148
+ function revokeAsyncNonce(uint256 nonce) external;
124
149
  function setEvvmID(uint256 newEvvmID) external;
125
150
  function setPointStaker(address user, bytes1 answer) external;
151
+ function validateAndConsumeNonce(
152
+ address user,
153
+ bytes32 hashPayload,
154
+ address originExecutor,
155
+ uint256 nonce,
156
+ bool isAsyncExec,
157
+ bytes memory signature
158
+ ) external;
126
159
  }
@@ -30,8 +30,8 @@ interface IEstimator {
30
30
  function getActualEpochInUint() external view returns (uint256);
31
31
  function getAddressStakingMetadata() external view returns (AddressTypeProposal memory);
32
32
  function getAdminMetadata() external view returns (AddressTypeProposal memory);
33
+ function getCoreAddressMetadata() external view returns (AddressTypeProposal memory);
33
34
  function getEpochMetadata() external view returns (EpochMetadata memory);
34
- function getEvvmAddressMetadata() external view returns (AddressTypeProposal memory);
35
35
  function makeEstimation(address _user)
36
36
  external
37
37
  returns (
@@ -5,21 +5,19 @@ pragma solidity ^0.8.0;
5
5
  library NameServiceStructs {
6
6
  struct OfferMetadata {
7
7
  address offerer;
8
- uint256 expireDate;
8
+ uint256 expirationDate;
9
9
  uint256 amount;
10
10
  }
11
11
  }
12
12
 
13
13
  interface INameService {
14
14
  error AmountMustBeGreaterThanZero();
15
- error AsyncNonceAlreadyUsed();
16
15
  error CannotBeBeforeCurrentTime();
17
16
  error EmptyCustomMetadata();
18
17
  error IdentityIsNotAUsername();
19
18
  error InvalidAdminProposal();
20
19
  error InvalidEvvmAddress();
21
20
  error InvalidKey();
22
- error InvalidSignatureOnNameService();
23
21
  error InvalidUsername();
24
22
  error InvalidWithdrawAmount();
25
23
  error LockTimeNotExpired();
@@ -38,24 +36,24 @@ interface INameService {
38
36
  address user,
39
37
  string memory username,
40
38
  uint256 offerID,
39
+ address originExecutor,
41
40
  uint256 nonce,
42
41
  bytes memory signature,
43
- uint256 priorityFee_EVVM,
44
- uint256 nonce_EVVM,
45
- bool priorityFlag_EVVM,
46
- bytes memory signature_EVVM
42
+ uint256 priorityFeePay,
43
+ uint256 noncePay,
44
+ bytes memory signaturePay
47
45
  ) external;
48
46
  function acceptProposeAdmin() external;
49
47
  function addCustomMetadata(
50
48
  address user,
51
49
  string memory identity,
52
50
  string memory value,
51
+ address originExecutor,
53
52
  uint256 nonce,
54
53
  bytes memory signature,
55
- uint256 priorityFee_EVVM,
56
- uint256 nonce_EVVM,
57
- bool priorityFlag_EVVM,
58
- bytes memory signature_EVVM
54
+ uint256 priorityFeePay,
55
+ uint256 noncePay,
56
+ bytes memory signaturePay
59
57
  ) external;
60
58
  function cancelChangeEvvmAddress() external;
61
59
  function cancelProposeAdmin() external;
@@ -64,22 +62,22 @@ interface INameService {
64
62
  function flushCustomMetadata(
65
63
  address user,
66
64
  string memory identity,
65
+ address originExecutor,
67
66
  uint256 nonce,
68
67
  bytes memory signature,
69
- uint256 priorityFee_EVVM,
70
- uint256 nonce_EVVM,
71
- bool priorityFlag_EVVM,
72
- bytes memory signature_EVVM
68
+ uint256 priorityFeePay,
69
+ uint256 noncePay,
70
+ bytes memory signaturePay
73
71
  ) external;
74
72
  function flushUsername(
75
73
  address user,
76
74
  string memory username,
75
+ address originExecutor,
77
76
  uint256 nonce,
78
77
  bytes memory signature,
79
- uint256 priorityFee_EVVM,
80
- uint256 nonce_EVVM,
81
- bool priorityFlag_EVVM,
82
- bytes memory signature_EVVM
78
+ uint256 priorityFeePay,
79
+ uint256 noncePay,
80
+ bytes memory signaturePay
83
81
  ) external;
84
82
  function getAdmin() external view returns (address);
85
83
  function getAdminFullDetails()
@@ -87,17 +85,16 @@ interface INameService {
87
85
  view
88
86
  returns (address currentAdmin, address proposalAdmin, uint256 timeToAcceptAdmin);
89
87
  function getAmountOfCustomMetadata(string memory _username) external view returns (uint256);
90
- function getCustomMetadataMaxSlotsOfIdentity(string memory _username) external view returns (uint256);
91
- function getEvvmAddress() external view returns (address);
92
- function getEvvmAddressFullDetails()
88
+ function getCoreAddress() external view returns (address);
89
+ function getCoreAddressFullDetails()
93
90
  external
94
91
  view
95
92
  returns (address currentEvvmAddress, address proposalEvvmAddress, uint256 timeToAcceptEvvmAddress);
93
+ function getCustomMetadataMaxSlotsOfIdentity(string memory _username) external view returns (uint256);
96
94
  function getEvvmID() external view returns (uint256);
97
95
  function getExpireDateOfIdentity(string memory _identity) external view returns (uint256);
98
96
  function getFullCustomMetadataOfIdentity(string memory _username) external view returns (string[] memory);
99
97
  function getIdentityBasicMetadata(string memory _username) external view returns (address, uint256);
100
- function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
101
98
  function getLengthOfOffersUsername(string memory _username) external view returns (uint256 length);
102
99
  function getOffersOfUsername(string memory _username)
103
100
  external
@@ -126,24 +123,24 @@ interface INameService {
126
123
  function makeOffer(
127
124
  address user,
128
125
  string memory username,
129
- uint256 expireDate,
130
126
  uint256 amount,
127
+ uint256 expirationDate,
128
+ address originExecutor,
131
129
  uint256 nonce,
132
130
  bytes memory signature,
133
- uint256 priorityFee_EVVM,
134
- uint256 nonce_EVVM,
135
- bool priorityFlag_EVVM,
136
- bytes memory signature_EVVM
131
+ uint256 priorityFeePay,
132
+ uint256 noncePay,
133
+ bytes memory signaturePay
137
134
  ) external returns (uint256 offerID);
138
135
  function preRegistrationUsername(
139
136
  address user,
140
137
  bytes32 hashPreRegisteredUsername,
138
+ address originExecutor,
141
139
  uint256 nonce,
142
140
  bytes memory signature,
143
- uint256 priorityFee_EVVM,
144
- uint256 nonce_EVVM,
145
- bool priorityFlag_EVVM,
146
- bytes memory signature_EVVM
141
+ uint256 priorityFeePay,
142
+ uint256 noncePay,
143
+ bytes memory signaturePay
147
144
  ) external;
148
145
  function proposeAdmin(address _adminToPropose) external;
149
146
  function proposeChangeEvvmAddress(address _newEvvmAddress) external;
@@ -151,34 +148,34 @@ interface INameService {
151
148
  function registrationUsername(
152
149
  address user,
153
150
  string memory username,
154
- uint256 clowNumber,
151
+ uint256 lockNumber,
152
+ address originExecutor,
155
153
  uint256 nonce,
156
154
  bytes memory signature,
157
- uint256 priorityFee_EVVM,
158
- uint256 nonce_EVVM,
159
- bool priorityFlag_EVVM,
160
- bytes memory signature_EVVM
155
+ uint256 priorityFeePay,
156
+ uint256 noncePay,
157
+ bytes memory signaturePay
161
158
  ) external;
162
159
  function removeCustomMetadata(
163
160
  address user,
164
161
  string memory identity,
165
162
  uint256 key,
163
+ address originExecutor,
166
164
  uint256 nonce,
167
165
  bytes memory signature,
168
- uint256 priorityFee_EVVM,
169
- uint256 nonce_EVVM,
170
- bool priorityFlag_EVVM,
171
- bytes memory signature_EVVM
166
+ uint256 priorityFeePay,
167
+ uint256 noncePay,
168
+ bytes memory signaturePay
172
169
  ) external;
173
170
  function renewUsername(
174
171
  address user,
175
172
  string memory username,
173
+ address originExecutor,
176
174
  uint256 nonce,
177
175
  bytes memory signature,
178
- uint256 priorityFee_EVVM,
179
- uint256 nonce_EVVM,
180
- bool priorityFlag_EVVM,
181
- bytes memory signature_EVVM
176
+ uint256 priorityFeePay,
177
+ uint256 noncePay,
178
+ bytes memory signaturePay
182
179
  ) external;
183
180
  function seePriceToRenew(string memory _identity) external view returns (uint256 price);
184
181
  function strictVerifyIfIdentityExist(string memory _username) external view returns (bool);
@@ -188,11 +185,11 @@ interface INameService {
188
185
  address user,
189
186
  string memory username,
190
187
  uint256 offerID,
188
+ address originExecutor,
191
189
  uint256 nonce,
192
190
  bytes memory signature,
193
- uint256 priorityFee_EVVM,
194
- uint256 nonce_EVVM,
195
- bool priorityFlag_EVVM,
196
- bytes memory signature_EVVM
191
+ uint256 priorityFeePay,
192
+ uint256 noncePay,
193
+ bytes memory signaturePay
197
194
  ) external;
198
195
  }
@@ -12,6 +12,7 @@ library P2PSwapStructs {
12
12
 
13
13
  struct MetadataCancelOrder {
14
14
  uint256 nonce;
15
+ address originExecutor;
15
16
  address tokenA;
16
17
  address tokenB;
17
18
  uint256 orderId;
@@ -20,6 +21,7 @@ library P2PSwapStructs {
20
21
 
21
22
  struct MetadataDispatchOrder {
22
23
  uint256 nonce;
24
+ address originExecutor;
23
25
  address tokenA;
24
26
  address tokenB;
25
27
  uint256 orderId;
@@ -29,6 +31,7 @@ library P2PSwapStructs {
29
31
 
30
32
  struct MetadataMakeOrder {
31
33
  uint256 nonce;
34
+ address originExecutor;
32
35
  address tokenA;
33
36
  address tokenB;
34
37
  uint256 amountA;
@@ -57,7 +60,6 @@ library P2PSwapStructs {
57
60
  }
58
61
 
59
62
  interface IP2PSwap {
60
- error AsyncNonceAlreadyUsed();
61
63
  error InvalidServiceSignature();
62
64
 
63
65
  function acceptFillFixedPercentage() external;
@@ -70,27 +72,24 @@ interface IP2PSwap {
70
72
  function cancelOrder(
71
73
  address user,
72
74
  P2PSwapStructs.MetadataCancelOrder memory metadata,
73
- uint256 _priorityFee_Evvm,
74
- uint256 _nonce_Evvm,
75
- bool _priority_Evvm,
76
- bytes memory _signature_Evvm
75
+ uint256 priorityFeePay,
76
+ uint256 noncePay,
77
+ bytes memory signaturePay
77
78
  ) external;
78
79
  function dispatchOrder_fillFixedFee(
79
80
  address user,
80
81
  P2PSwapStructs.MetadataDispatchOrder memory metadata,
81
- uint256 _priorityFee_Evvm,
82
- uint256 _nonce_Evvm,
83
- bool _priority_Evvm,
84
- bytes memory _signature_Evvm,
82
+ uint256 priorityFeePay,
83
+ uint256 noncePay,
84
+ bytes memory signaturePay,
85
85
  uint256 maxFillFixedFee
86
86
  ) external;
87
87
  function dispatchOrder_fillPropotionalFee(
88
88
  address user,
89
89
  P2PSwapStructs.MetadataDispatchOrder memory metadata,
90
- uint256 _priorityFee_Evvm,
91
- uint256 _nonce_Evvm,
92
- bool _priority_Evvm,
93
- bytes memory _signature_Evvm
90
+ uint256 priorityFeePay,
91
+ uint256 noncePay,
92
+ bytes memory signaturePay
94
93
  ) external;
95
94
  function findMarket(address tokenA, address tokenB) external view returns (uint256);
96
95
  function getAllMarketOrders(uint256 market) external view returns (P2PSwapStructs.OrderForGetter[] memory orders);
@@ -104,6 +103,7 @@ interface IP2PSwap {
104
103
  external
105
104
  view
106
105
  returns (P2PSwapStructs.OrderForGetter[] memory orders);
106
+ function getNextCurrentSyncNonce(address user) external view returns (uint256);
107
107
  function getOrder(uint256 market, uint256 orderId) external view returns (P2PSwapStructs.Order memory order);
108
108
  function getOwner() external view returns (address);
109
109
  function getOwnerProposal() external view returns (address);
@@ -117,10 +117,9 @@ interface IP2PSwap {
117
117
  address user,
118
118
  P2PSwapStructs.MetadataMakeOrder memory metadata,
119
119
  bytes memory signature,
120
- uint256 _priorityFee_Evvm,
121
- uint256 _nonce_Evvm,
122
- bool _priority_Evvm,
123
- bytes memory _signature_Evvm
120
+ uint256 priorityFeePay,
121
+ uint256 noncePay,
122
+ bytes memory signaturePay
124
123
  ) external returns (uint256 market, uint256 orderId);
125
124
  function proposeFillFixedPercentage(uint256 _seller, uint256 _service, uint256 _mateStaker) external;
126
125
  function proposeFillPropotionalPercentage(uint256 _seller, uint256 _service, uint256 _mateStaker) external;
@@ -2,12 +2,14 @@
2
2
  // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
3
3
  pragma solidity ^0.8.0;
4
4
 
5
- library StakingStructs {
5
+ library ProposalStructs {
6
6
  struct BoolTypeProposal {
7
7
  bool flag;
8
8
  uint256 timeToAccept;
9
9
  }
10
+ }
10
11
 
12
+ library StakingStructs {
11
13
  struct HistoryMetadata {
12
14
  bytes32 transactionType;
13
15
  uint256 amount;
@@ -21,17 +23,18 @@ interface IStaking {
21
23
  error AddressMismatch();
22
24
  error AddressMustWaitToFullUnstake();
23
25
  error AddressMustWaitToStakeAgain();
24
- error AsyncNonceAlreadyUsed();
25
- error InvalidSignatureOnStaking();
26
+ error LimitPresaleStakersExceeded();
26
27
  error PresaleStakingDisabled();
28
+ error PublicStakingDisabled();
27
29
  error SenderIsNotAdmin();
28
30
  error SenderIsNotGoldenFisher();
31
+ error SenderIsNotProposedAdmin();
29
32
  error ServiceDoesNotFulfillCorrectStakingAmount(uint256 requiredAmount);
30
33
  error ServiceDoesNotStakeInSameTx();
34
+ error TimeToAcceptProposalNotReached();
31
35
  error UserIsNotPresaleStaker();
32
36
  error UserPresaleStakerLimitExceeded();
33
37
 
34
- function _setupEstimatorAndEvvm(address _estimator, address _evvm) external;
35
38
  function acceptNewAdmin() external;
36
39
  function acceptNewEstimator() external;
37
40
  function acceptNewGoldenFisher() external;
@@ -50,16 +53,16 @@ interface IStaking {
50
53
  external
51
54
  view
52
55
  returns (StakingStructs.HistoryMetadata memory);
53
- function getAllowPresaleStaking() external view returns (StakingStructs.BoolTypeProposal memory);
54
- function getAllowPublicStaking() external view returns (StakingStructs.BoolTypeProposal memory);
56
+ function getAllowPresaleStaking() external view returns (ProposalStructs.BoolTypeProposal memory);
57
+ function getAllowPublicStaking() external view returns (ProposalStructs.BoolTypeProposal memory);
58
+ function getCoreAddress() external view returns (address);
55
59
  function getEstimatorAddress() external view returns (address);
56
60
  function getEstimatorProposal() external view returns (address);
57
- function getEvvmAddress() external view returns (address);
58
61
  function getEvvmID() external view returns (uint256);
59
62
  function getGoldenFisher() external view returns (address);
60
63
  function getGoldenFisherProposal() external view returns (address);
61
64
  function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
62
- function getMateAddress() external pure returns (address);
65
+ function getMateAddress() external view returns (address);
63
66
  function getOwner() external view returns (address);
64
67
  function getPresaleStaker(address _account) external view returns (bool, uint256);
65
68
  function getPresaleStakerCount() external view returns (uint256);
@@ -78,7 +81,8 @@ interface IStaking {
78
81
  uint256 idToOverwriteUserHistory,
79
82
  uint256 timestampToBeOverwritten
80
83
  );
81
- function goldenStaking(bool isStaking, uint256 amountOfStaking, bytes memory signature_EVVM) external;
84
+ function goldenStaking(bool isStaking, uint256 amountOfStaking, bytes memory signaturePay) external;
85
+ function initializeSystemContracts(address _estimator, address _core) external;
82
86
  function prepareChangeAllowPresaleStaking() external;
83
87
  function prepareChangeAllowPublicStaking() external;
84
88
  function prepareServiceStaking(uint256 amountOfStaking) external;
@@ -86,12 +90,12 @@ interface IStaking {
86
90
  function presaleStaking(
87
91
  address user,
88
92
  bool isStaking,
93
+ address originExecutor,
89
94
  uint256 nonce,
90
95
  bytes memory signature,
91
- uint256 priorityFee_EVVM,
92
- uint256 nonce_EVVM,
93
- bool priorityFlag_EVVM,
94
- bytes memory signature_EVVM
96
+ uint256 priorityFeePay,
97
+ uint256 noncePay,
98
+ bytes memory signaturePay
95
99
  ) external;
96
100
  function priceOfStaking() external pure returns (uint256);
97
101
  function proposeAdmin(address _newAdmin) external;
@@ -102,12 +106,12 @@ interface IStaking {
102
106
  address user,
103
107
  bool isStaking,
104
108
  uint256 amountOfStaking,
109
+ address originExecutor,
105
110
  uint256 nonce,
106
111
  bytes memory signature,
107
- uint256 priorityFee_EVVM,
108
- uint256 nonce_EVVM,
109
- bool priorityFlag_EVVM,
110
- bytes memory signature_EVVM
112
+ uint256 priorityFeePay,
113
+ uint256 noncePay,
114
+ bytes memory signaturePay
111
115
  ) external;
112
116
  function rejectProposalAdmin() external;
113
117
  function rejectProposalEstimator() external;
@@ -4,11 +4,12 @@ pragma solidity ^0.8.0;
4
4
 
5
5
  interface ITreasury {
6
6
  error DepositAmountMustBeGreaterThanZero();
7
+ error DepositCoinWithToken();
7
8
  error InsufficientBalance();
8
9
  error InvalidDepositAmount();
9
10
  error PrincipalTokenIsNotWithdrawable();
10
11
 
11
12
  function deposit(address token, uint256 amount) external payable;
12
- function getEvvmAddress() external view returns (address);
13
+ function getCoreAddress() external view returns (address);
13
14
  function withdraw(address token, uint256 amount) external;
14
15
  }
@@ -3,12 +3,6 @@
3
3
  pragma solidity ^0.8.0;
4
4
 
5
5
  library ExternalChainStationStructs {
6
- struct AddressTypeProposal {
7
- address current;
8
- address proposal;
9
- uint256 timeToAccept;
10
- }
11
-
12
6
  struct AxelarConfig {
13
7
  string hostChainStationChainName;
14
8
  string hostChainStationAddress;
@@ -35,6 +29,14 @@ library ExternalChainStationStructs {
35
29
  }
36
30
  }
37
31
 
32
+ library ProposalStructs {
33
+ struct AddressTypeProposal {
34
+ address current;
35
+ address proposal;
36
+ uint256 timeToAccept;
37
+ }
38
+ }
39
+
38
40
  interface ITreasuryExternalChainStation {
39
41
  struct EnforcedOptionParam {
40
42
  uint32 eid;
@@ -50,6 +52,7 @@ interface ITreasuryExternalChainStation {
50
52
 
51
53
  error AddressEmptyCode(address target);
52
54
  error AddressInsufficientBalance(address account);
55
+ error AsyncNonceAlreadyUsed();
53
56
  error ChainIdNotAuthorized();
54
57
  error FailedInnerCall();
55
58
  error InsufficientBalance();
@@ -106,6 +109,7 @@ interface ITreasuryExternalChainStation {
106
109
  address tokenAddress,
107
110
  uint256 priorityFee,
108
111
  uint256 amount,
112
+ uint256 nonce,
109
113
  bytes memory signature
110
114
  ) external;
111
115
  function fisherBridgeSendCoin(
@@ -113,6 +117,7 @@ interface ITreasuryExternalChainStation {
113
117
  address addressToReceive,
114
118
  uint256 priorityFee,
115
119
  uint256 amount,
120
+ uint256 nonce,
116
121
  bytes memory signature
117
122
  ) external payable;
118
123
  function fisherBridgeSendERC20(
@@ -121,15 +126,16 @@ interface ITreasuryExternalChainStation {
121
126
  address tokenAddress,
122
127
  uint256 priorityFee,
123
128
  uint256 amount,
129
+ uint256 nonce,
124
130
  bytes memory signature
125
131
  ) external;
126
132
  function gateway() external view returns (address);
127
- function getAdmin() external view returns (ExternalChainStationStructs.AddressTypeProposal memory);
133
+ function getAdmin() external view returns (ProposalStructs.AddressTypeProposal memory);
128
134
  function getAxelarConfig() external view returns (ExternalChainStationStructs.AxelarConfig memory);
129
- function getFisherExecutor() external view returns (ExternalChainStationStructs.AddressTypeProposal memory);
135
+ function getFisherExecutor() external view returns (ProposalStructs.AddressTypeProposal memory);
130
136
  function getHyperlaneConfig() external view returns (ExternalChainStationStructs.HyperlaneConfig memory);
137
+ function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
131
138
  function getLayerZeroConfig() external view returns (ExternalChainStationStructs.LayerZeroConfig memory);
132
- function getNextFisherExecutionNonce(address user) external view returns (uint256);
133
139
  function getOptions() external view returns (bytes memory);
134
140
  function getQuoteHyperlane(address toAddress, address token, uint256 amount) external view returns (uint256);
135
141
  function handle(uint32 _origin, bytes32 _sender, bytes memory _data) external payable;