@evvm/testnet-contracts 2.2.3 → 3.0.0
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.
- package/LICENSE +145 -118
- package/README.md +162 -39
- package/contracts/core/Core.sol +1394 -0
- package/contracts/core/lib/CoreStorage.sol +171 -0
- package/contracts/nameService/NameService.sol +666 -586
- package/contracts/nameService/lib/IdentityValidation.sol +18 -3
- package/contracts/p2pSwap/P2PSwap.sol +439 -285
- package/contracts/staking/Estimator.sol +128 -40
- package/contracts/staking/Staking.sol +329 -322
- package/contracts/treasury/Treasury.sol +48 -37
- package/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +585 -198
- package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +425 -174
- package/contracts/treasuryTwoChains/lib/PayloadUtils.sol +2 -4
- package/interfaces/{IEvvm.sol → ICore.sol} +67 -29
- package/interfaces/IEstimator.sol +1 -1
- package/interfaces/INameService.sol +58 -52
- package/interfaces/IP2PSwap.sol +18 -17
- package/interfaces/IStaking.sol +22 -17
- package/interfaces/ITreasury.sol +2 -1
- package/interfaces/ITreasuryExternalChainStation.sol +15 -9
- package/interfaces/ITreasuryHostChainStation.sol +14 -11
- package/interfaces/IUserValidator.sol +6 -0
- package/library/Erc191TestBuilder.sol +350 -297
- package/library/EvvmService.sol +38 -27
- package/library/errors/CoreError.sol +116 -0
- package/library/errors/CrossChainTreasuryError.sol +36 -0
- package/library/errors/NameServiceError.sol +79 -0
- package/library/errors/StakingError.sol +79 -0
- package/library/errors/TreasuryError.sol +33 -0
- package/library/primitives/SignatureRecover.sol +33 -0
- package/library/structs/CoreStructs.sol +146 -0
- package/library/structs/ExternalChainStationStructs.sol +92 -0
- package/library/structs/HostChainStationStructs.sol +77 -0
- package/library/structs/NameServiceStructs.sol +47 -0
- package/library/structs/P2PSwapStructs.sol +127 -0
- package/library/structs/StakingStructs.sol +67 -0
- package/library/utils/AdvancedStrings.sol +84 -5
- package/library/utils/CAUtils.sol +29 -0
- package/library/utils/SignatureUtil.sol +34 -0
- package/library/utils/governance/Admin.sol +66 -0
- package/library/utils/governance/ProposalStructs.sol +49 -0
- package/library/utils/service/CoreExecution.sol +177 -0
- package/library/utils/service/StakingServiceUtils.sol +30 -3
- package/library/utils/signature/CoreHashUtils.sol +73 -0
- package/library/utils/signature/NameServiceHashUtils.sol +156 -0
- package/library/utils/signature/P2PSwapHashUtils.sol +65 -0
- package/library/utils/signature/StakingHashUtils.sol +41 -0
- package/library/utils/signature/TreasuryCrossChainHashUtils.sol +40 -0
- package/package.json +2 -1
- package/contracts/evvm/Evvm.sol +0 -1327
- package/contracts/evvm/lib/ErrorsLib.sol +0 -18
- package/contracts/evvm/lib/EvvmStorage.sol +0 -62
- package/contracts/evvm/lib/EvvmStructs.sol +0 -90
- package/contracts/evvm/lib/SignatureUtils.sol +0 -120
- package/contracts/nameService/lib/ErrorsLib.sol +0 -21
- package/contracts/nameService/lib/NameServiceStructs.sol +0 -69
- package/contracts/nameService/lib/SignatureUtils.sol +0 -245
- package/contracts/p2pSwap/lib/P2PSwapStructs.sol +0 -59
- package/contracts/p2pSwap/lib/SignatureUtils.sol +0 -98
- package/contracts/staking/lib/ErrorsLib.sol +0 -22
- package/contracts/staking/lib/SignatureUtils.sol +0 -39
- package/contracts/staking/lib/StakingStructs.sol +0 -94
- package/contracts/treasury/lib/ErrorsLib.sol +0 -11
- package/contracts/treasuryTwoChains/lib/ErrorsLib.sol +0 -48
- package/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +0 -80
- package/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +0 -87
- package/contracts/treasuryTwoChains/lib/SignatureUtils.sol +0 -79
- package/library/utils/GovernanceUtils.sol +0 -81
- package/library/utils/nonces/AsyncNonce.sol +0 -32
- package/library/utils/nonces/SyncNonce.sol +0 -27
- package/library/utils/service/EvvmPayments.sol +0 -79
|
@@ -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
|
|
9
|
-
* @dev
|
|
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
|
|
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,60 +37,75 @@ library EvvmStructs {
|
|
|
24
37
|
uint256 eraTokens;
|
|
25
38
|
uint256 reward;
|
|
26
39
|
}
|
|
40
|
+
}
|
|
27
41
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
address
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
50
|
+
interface ICore {
|
|
51
|
+
error AddressCantBeZero();
|
|
52
|
+
error AsyncNonceAlreadyReserved();
|
|
43
53
|
error AsyncNonceAlreadyUsed();
|
|
54
|
+
error AsyncNonceIsReservedByAnotherService();
|
|
55
|
+
error AsyncNonceNotReserved();
|
|
56
|
+
error BreakerExploded();
|
|
57
|
+
error ImplementationIsNotActive();
|
|
58
|
+
error IncorrectAddressInput();
|
|
44
59
|
error InsufficientBalance();
|
|
45
|
-
error InvalidAmount(
|
|
60
|
+
error InvalidAmount();
|
|
61
|
+
error InvalidServiceAddress();
|
|
46
62
|
error InvalidSignature();
|
|
63
|
+
error MsgSenderIsNotAContract();
|
|
47
64
|
error NotAnCA();
|
|
48
|
-
error
|
|
65
|
+
error OriginIsNotTheOriginExecutor();
|
|
66
|
+
error ProposalForUserValidatorNotReady();
|
|
67
|
+
error SenderIsNotAdmin();
|
|
68
|
+
error SenderIsNotTheProposedAdmin();
|
|
69
|
+
error SenderIsNotTheSenderExecutor();
|
|
49
70
|
error SenderIsNotTreasury();
|
|
50
71
|
error SyncNonceMismatch();
|
|
51
|
-
error
|
|
52
|
-
error
|
|
72
|
+
error TimeLockNotExpired();
|
|
73
|
+
error UserCannotExecuteTransaction();
|
|
74
|
+
error WindowExpired();
|
|
53
75
|
|
|
54
76
|
fallback() external;
|
|
55
77
|
|
|
56
|
-
function _setupNameServiceAndTreasuryAddress(address _nameServiceAddress, address _treasuryAddress) external;
|
|
57
78
|
function acceptAdmin() external;
|
|
58
79
|
function acceptImplementation() external;
|
|
80
|
+
function acceptUserValidatorProposal() external;
|
|
59
81
|
function addAmountToUser(address user, address token, uint256 amount) external;
|
|
60
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);
|
|
61
87
|
function caPay(address to, address token, uint256 amount) external;
|
|
62
|
-
function
|
|
88
|
+
function cancelUserValidatorProposal() external;
|
|
89
|
+
function disperseCaPay(CoreStructs.DisperseCaPayMetadata[] memory toData, address token, uint256 amount) external;
|
|
63
90
|
function dispersePay(
|
|
64
91
|
address from,
|
|
65
|
-
|
|
92
|
+
CoreStructs.DispersePayMetadata[] memory toData,
|
|
66
93
|
address token,
|
|
67
94
|
uint256 amount,
|
|
68
95
|
uint256 priorityFee,
|
|
96
|
+
address senderExecutor,
|
|
69
97
|
uint256 nonce,
|
|
70
|
-
bool
|
|
71
|
-
address executor,
|
|
98
|
+
bool isAsyncExec,
|
|
72
99
|
bytes memory signature
|
|
73
100
|
) external;
|
|
101
|
+
function getAsyncNonceReservation(address user, uint256 nonce) external view returns (address);
|
|
74
102
|
function getBalance(address user, address token) external view returns (uint256);
|
|
75
103
|
function getChainHostCoinAddress() external pure returns (address);
|
|
76
104
|
function getCurrentAdmin() external view returns (address);
|
|
77
105
|
function getCurrentImplementation() external view returns (address);
|
|
78
106
|
function getEraPrincipalToken() external view returns (uint256);
|
|
79
107
|
function getEvvmID() external view returns (uint256);
|
|
80
|
-
function getEvvmMetadata() external view returns (
|
|
108
|
+
function getEvvmMetadata() external view returns (CoreStructs.EvvmMetadata memory);
|
|
81
109
|
function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
|
|
82
110
|
function getNameServiceAddress() external view returns (address);
|
|
83
111
|
function getNextCurrentSyncNonce(address user) external view returns (uint256);
|
|
@@ -90,8 +118,11 @@ interface IEvvm {
|
|
|
90
118
|
function getStakingContractAddress() external view returns (address);
|
|
91
119
|
function getTimeToAcceptAdmin() external view returns (uint256);
|
|
92
120
|
function getTimeToAcceptImplementation() external view returns (uint256);
|
|
121
|
+
function getUserValidatorAddress() external view returns (address);
|
|
122
|
+
function getUserValidatorAddressDetails() external view returns (ProposalStructs.AddressTypeProposal memory);
|
|
93
123
|
function getWhitelistTokenToBeAdded() external view returns (address);
|
|
94
124
|
function getWhitelistTokenToBeAddedDateToSet() external view returns (uint256);
|
|
125
|
+
function initializeSystemContracts(address _nameServiceAddress, address _treasuryAddress) external;
|
|
95
126
|
function isAddressStaker(address user) external view returns (bool);
|
|
96
127
|
function pay(
|
|
97
128
|
address from,
|
|
@@ -100,22 +131,29 @@ interface IEvvm {
|
|
|
100
131
|
address token,
|
|
101
132
|
uint256 amount,
|
|
102
133
|
uint256 priorityFee,
|
|
134
|
+
address senderExecutor,
|
|
103
135
|
uint256 nonce,
|
|
104
|
-
bool
|
|
105
|
-
address executor,
|
|
136
|
+
bool isAsyncExec,
|
|
106
137
|
bytes memory signature
|
|
107
138
|
) external;
|
|
108
|
-
function payMultiple(EvvmStructs.PayData[] memory payData)
|
|
109
|
-
external
|
|
110
|
-
returns (uint256 successfulTransactions, bool[] memory results);
|
|
111
139
|
function pointStaker(address user, bytes1 answer) external;
|
|
112
140
|
function proposeAdmin(address _newOwner) external;
|
|
113
141
|
function proposeImplementation(address _newImpl) external;
|
|
142
|
+
function proposeUserValidator(address newValidator) external;
|
|
114
143
|
function recalculateReward() external;
|
|
115
144
|
function rejectProposalAdmin() external;
|
|
116
145
|
function rejectUpgrade() external;
|
|
117
146
|
function removeAmountFromUser(address user, address token, uint256 amount) external;
|
|
147
|
+
function reserveAsyncNonce(uint256 nonce, address serviceAddress) external;
|
|
148
|
+
function revokeAsyncNonce(address user, uint256 nonce) external;
|
|
118
149
|
function setEvvmID(uint256 newEvvmID) external;
|
|
119
|
-
function setNameServiceAddress(address _nameServiceAddress) external;
|
|
120
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;
|
|
121
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,22 +5,28 @@ pragma solidity ^0.8.0;
|
|
|
5
5
|
library NameServiceStructs {
|
|
6
6
|
struct OfferMetadata {
|
|
7
7
|
address offerer;
|
|
8
|
-
uint256
|
|
8
|
+
uint256 expirationDate;
|
|
9
9
|
uint256 amount;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface INameService {
|
|
14
|
-
error
|
|
15
|
-
error
|
|
14
|
+
error AmountMustBeGreaterThanZero();
|
|
15
|
+
error CannotBeBeforeCurrentTime();
|
|
16
16
|
error EmptyCustomMetadata();
|
|
17
|
-
error
|
|
17
|
+
error IdentityIsNotAUsername();
|
|
18
|
+
error InvalidAdminProposal();
|
|
19
|
+
error InvalidEvvmAddress();
|
|
18
20
|
error InvalidKey();
|
|
19
|
-
error InvalidSignatureOnNameService();
|
|
20
21
|
error InvalidUsername();
|
|
22
|
+
error InvalidWithdrawAmount();
|
|
23
|
+
error LockTimeNotExpired();
|
|
24
|
+
error OfferInactive();
|
|
25
|
+
error OwnershipExpired();
|
|
21
26
|
error PreRegistrationNotValid();
|
|
22
|
-
error
|
|
27
|
+
error RenewalTimeLimitExceeded();
|
|
23
28
|
error SenderIsNotAdmin();
|
|
29
|
+
error SenderIsNotProposedAdmin();
|
|
24
30
|
error UserIsNotOwnerOfIdentity();
|
|
25
31
|
error UserIsNotOwnerOfOffer();
|
|
26
32
|
error UsernameAlreadyRegistered();
|
|
@@ -30,24 +36,24 @@ interface INameService {
|
|
|
30
36
|
address user,
|
|
31
37
|
string memory username,
|
|
32
38
|
uint256 offerID,
|
|
39
|
+
address originExecutor,
|
|
33
40
|
uint256 nonce,
|
|
34
41
|
bytes memory signature,
|
|
35
|
-
uint256
|
|
36
|
-
uint256
|
|
37
|
-
|
|
38
|
-
bytes memory signature_EVVM
|
|
42
|
+
uint256 priorityFeePay,
|
|
43
|
+
uint256 noncePay,
|
|
44
|
+
bytes memory signaturePay
|
|
39
45
|
) external;
|
|
40
46
|
function acceptProposeAdmin() external;
|
|
41
47
|
function addCustomMetadata(
|
|
42
48
|
address user,
|
|
43
49
|
string memory identity,
|
|
44
50
|
string memory value,
|
|
51
|
+
address originExecutor,
|
|
45
52
|
uint256 nonce,
|
|
46
53
|
bytes memory signature,
|
|
47
|
-
uint256
|
|
48
|
-
uint256
|
|
49
|
-
|
|
50
|
-
bytes memory signature_EVVM
|
|
54
|
+
uint256 priorityFeePay,
|
|
55
|
+
uint256 noncePay,
|
|
56
|
+
bytes memory signaturePay
|
|
51
57
|
) external;
|
|
52
58
|
function cancelChangeEvvmAddress() external;
|
|
53
59
|
function cancelProposeAdmin() external;
|
|
@@ -56,22 +62,22 @@ interface INameService {
|
|
|
56
62
|
function flushCustomMetadata(
|
|
57
63
|
address user,
|
|
58
64
|
string memory identity,
|
|
65
|
+
address originExecutor,
|
|
59
66
|
uint256 nonce,
|
|
60
67
|
bytes memory signature,
|
|
61
|
-
uint256
|
|
62
|
-
uint256
|
|
63
|
-
|
|
64
|
-
bytes memory signature_EVVM
|
|
68
|
+
uint256 priorityFeePay,
|
|
69
|
+
uint256 noncePay,
|
|
70
|
+
bytes memory signaturePay
|
|
65
71
|
) external;
|
|
66
72
|
function flushUsername(
|
|
67
73
|
address user,
|
|
68
74
|
string memory username,
|
|
75
|
+
address originExecutor,
|
|
69
76
|
uint256 nonce,
|
|
70
77
|
bytes memory signature,
|
|
71
|
-
uint256
|
|
72
|
-
uint256
|
|
73
|
-
|
|
74
|
-
bytes memory signature_EVVM
|
|
78
|
+
uint256 priorityFeePay,
|
|
79
|
+
uint256 noncePay,
|
|
80
|
+
bytes memory signaturePay
|
|
75
81
|
) external;
|
|
76
82
|
function getAdmin() external view returns (address);
|
|
77
83
|
function getAdminFullDetails()
|
|
@@ -79,16 +85,16 @@ interface INameService {
|
|
|
79
85
|
view
|
|
80
86
|
returns (address currentAdmin, address proposalAdmin, uint256 timeToAcceptAdmin);
|
|
81
87
|
function getAmountOfCustomMetadata(string memory _username) external view returns (uint256);
|
|
82
|
-
function
|
|
83
|
-
function
|
|
84
|
-
function getEvvmAddressFullDetails()
|
|
88
|
+
function getCoreAddress() external view returns (address);
|
|
89
|
+
function getCoreAddressFullDetails()
|
|
85
90
|
external
|
|
86
91
|
view
|
|
87
92
|
returns (address currentEvvmAddress, address proposalEvvmAddress, uint256 timeToAcceptEvvmAddress);
|
|
93
|
+
function getCustomMetadataMaxSlotsOfIdentity(string memory _username) external view returns (uint256);
|
|
94
|
+
function getEvvmID() external view returns (uint256);
|
|
88
95
|
function getExpireDateOfIdentity(string memory _identity) external view returns (uint256);
|
|
89
96
|
function getFullCustomMetadataOfIdentity(string memory _username) external view returns (string[] memory);
|
|
90
97
|
function getIdentityBasicMetadata(string memory _username) external view returns (address, uint256);
|
|
91
|
-
function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
|
|
92
98
|
function getLengthOfOffersUsername(string memory _username) external view returns (uint256 length);
|
|
93
99
|
function getOffersOfUsername(string memory _username)
|
|
94
100
|
external
|
|
@@ -117,24 +123,24 @@ interface INameService {
|
|
|
117
123
|
function makeOffer(
|
|
118
124
|
address user,
|
|
119
125
|
string memory username,
|
|
120
|
-
uint256 expireDate,
|
|
121
126
|
uint256 amount,
|
|
127
|
+
uint256 expirationDate,
|
|
128
|
+
address originExecutor,
|
|
122
129
|
uint256 nonce,
|
|
123
130
|
bytes memory signature,
|
|
124
|
-
uint256
|
|
125
|
-
uint256
|
|
126
|
-
|
|
127
|
-
bytes memory signature_EVVM
|
|
131
|
+
uint256 priorityFeePay,
|
|
132
|
+
uint256 noncePay,
|
|
133
|
+
bytes memory signaturePay
|
|
128
134
|
) external returns (uint256 offerID);
|
|
129
135
|
function preRegistrationUsername(
|
|
130
136
|
address user,
|
|
131
137
|
bytes32 hashPreRegisteredUsername,
|
|
138
|
+
address originExecutor,
|
|
132
139
|
uint256 nonce,
|
|
133
140
|
bytes memory signature,
|
|
134
|
-
uint256
|
|
135
|
-
uint256
|
|
136
|
-
|
|
137
|
-
bytes memory signature_EVVM
|
|
141
|
+
uint256 priorityFeePay,
|
|
142
|
+
uint256 noncePay,
|
|
143
|
+
bytes memory signaturePay
|
|
138
144
|
) external;
|
|
139
145
|
function proposeAdmin(address _adminToPropose) external;
|
|
140
146
|
function proposeChangeEvvmAddress(address _newEvvmAddress) external;
|
|
@@ -142,34 +148,34 @@ interface INameService {
|
|
|
142
148
|
function registrationUsername(
|
|
143
149
|
address user,
|
|
144
150
|
string memory username,
|
|
145
|
-
uint256
|
|
151
|
+
uint256 lockNumber,
|
|
152
|
+
address originExecutor,
|
|
146
153
|
uint256 nonce,
|
|
147
154
|
bytes memory signature,
|
|
148
|
-
uint256
|
|
149
|
-
uint256
|
|
150
|
-
|
|
151
|
-
bytes memory signature_EVVM
|
|
155
|
+
uint256 priorityFeePay,
|
|
156
|
+
uint256 noncePay,
|
|
157
|
+
bytes memory signaturePay
|
|
152
158
|
) external;
|
|
153
159
|
function removeCustomMetadata(
|
|
154
160
|
address user,
|
|
155
161
|
string memory identity,
|
|
156
162
|
uint256 key,
|
|
163
|
+
address originExecutor,
|
|
157
164
|
uint256 nonce,
|
|
158
165
|
bytes memory signature,
|
|
159
|
-
uint256
|
|
160
|
-
uint256
|
|
161
|
-
|
|
162
|
-
bytes memory signature_EVVM
|
|
166
|
+
uint256 priorityFeePay,
|
|
167
|
+
uint256 noncePay,
|
|
168
|
+
bytes memory signaturePay
|
|
163
169
|
) external;
|
|
164
170
|
function renewUsername(
|
|
165
171
|
address user,
|
|
166
172
|
string memory username,
|
|
173
|
+
address originExecutor,
|
|
167
174
|
uint256 nonce,
|
|
168
175
|
bytes memory signature,
|
|
169
|
-
uint256
|
|
170
|
-
uint256
|
|
171
|
-
|
|
172
|
-
bytes memory signature_EVVM
|
|
176
|
+
uint256 priorityFeePay,
|
|
177
|
+
uint256 noncePay,
|
|
178
|
+
bytes memory signaturePay
|
|
173
179
|
) external;
|
|
174
180
|
function seePriceToRenew(string memory _identity) external view returns (uint256 price);
|
|
175
181
|
function strictVerifyIfIdentityExist(string memory _username) external view returns (bool);
|
|
@@ -179,11 +185,11 @@ interface INameService {
|
|
|
179
185
|
address user,
|
|
180
186
|
string memory username,
|
|
181
187
|
uint256 offerID,
|
|
188
|
+
address originExecutor,
|
|
182
189
|
uint256 nonce,
|
|
183
190
|
bytes memory signature,
|
|
184
|
-
uint256
|
|
185
|
-
uint256
|
|
186
|
-
|
|
187
|
-
bytes memory signature_EVVM
|
|
191
|
+
uint256 priorityFeePay,
|
|
192
|
+
uint256 noncePay,
|
|
193
|
+
bytes memory signaturePay
|
|
188
194
|
) external;
|
|
189
195
|
}
|
package/interfaces/IP2PSwap.sol
CHANGED
|
@@ -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
|
|
74
|
-
uint256
|
|
75
|
-
|
|
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
|
|
82
|
-
uint256
|
|
83
|
-
|
|
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
|
|
91
|
-
uint256
|
|
92
|
-
|
|
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
|
|
121
|
-
uint256
|
|
122
|
-
|
|
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;
|
|
@@ -134,6 +133,8 @@ interface IP2PSwap {
|
|
|
134
133
|
function rejectProposeOwner() external;
|
|
135
134
|
function rejectProposePercentageFee() external;
|
|
136
135
|
function rejectProposeWithdrawal() external;
|
|
136
|
+
function reserveAsyncNonceToService(uint256 nonce) external;
|
|
137
|
+
function revokeAsyncNonceToService(address user, uint256 nonce) external;
|
|
137
138
|
function stake(uint256 amount) external;
|
|
138
139
|
function unstake(uint256 amount) external;
|
|
139
140
|
}
|
package/interfaces/IStaking.sol
CHANGED
|
@@ -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
|
|
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
|
|
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,15 +53,16 @@ interface IStaking {
|
|
|
50
53
|
external
|
|
51
54
|
view
|
|
52
55
|
returns (StakingStructs.HistoryMetadata memory);
|
|
53
|
-
function
|
|
54
|
-
function
|
|
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
|
|
61
|
+
function getEvvmID() external view returns (uint256);
|
|
58
62
|
function getGoldenFisher() external view returns (address);
|
|
59
63
|
function getGoldenFisherProposal() external view returns (address);
|
|
60
64
|
function getIfUsedAsyncNonce(address user, uint256 nonce) external view returns (bool);
|
|
61
|
-
function getMateAddress() external
|
|
65
|
+
function getMateAddress() external view returns (address);
|
|
62
66
|
function getOwner() external view returns (address);
|
|
63
67
|
function getPresaleStaker(address _account) external view returns (bool, uint256);
|
|
64
68
|
function getPresaleStakerCount() external view returns (uint256);
|
|
@@ -77,7 +81,8 @@ interface IStaking {
|
|
|
77
81
|
uint256 idToOverwriteUserHistory,
|
|
78
82
|
uint256 timestampToBeOverwritten
|
|
79
83
|
);
|
|
80
|
-
function goldenStaking(bool isStaking, uint256 amountOfStaking, bytes memory
|
|
84
|
+
function goldenStaking(bool isStaking, uint256 amountOfStaking, bytes memory signaturePay) external;
|
|
85
|
+
function initializeSystemContracts(address _estimator, address _core) external;
|
|
81
86
|
function prepareChangeAllowPresaleStaking() external;
|
|
82
87
|
function prepareChangeAllowPublicStaking() external;
|
|
83
88
|
function prepareServiceStaking(uint256 amountOfStaking) external;
|
|
@@ -85,12 +90,12 @@ interface IStaking {
|
|
|
85
90
|
function presaleStaking(
|
|
86
91
|
address user,
|
|
87
92
|
bool isStaking,
|
|
93
|
+
address originExecutor,
|
|
88
94
|
uint256 nonce,
|
|
89
95
|
bytes memory signature,
|
|
90
|
-
uint256
|
|
91
|
-
uint256
|
|
92
|
-
|
|
93
|
-
bytes memory signature_EVVM
|
|
96
|
+
uint256 priorityFeePay,
|
|
97
|
+
uint256 noncePay,
|
|
98
|
+
bytes memory signaturePay
|
|
94
99
|
) external;
|
|
95
100
|
function priceOfStaking() external pure returns (uint256);
|
|
96
101
|
function proposeAdmin(address _newAdmin) external;
|
|
@@ -101,12 +106,12 @@ interface IStaking {
|
|
|
101
106
|
address user,
|
|
102
107
|
bool isStaking,
|
|
103
108
|
uint256 amountOfStaking,
|
|
109
|
+
address originExecutor,
|
|
104
110
|
uint256 nonce,
|
|
105
111
|
bytes memory signature,
|
|
106
|
-
uint256
|
|
107
|
-
uint256
|
|
108
|
-
|
|
109
|
-
bytes memory signature_EVVM
|
|
112
|
+
uint256 priorityFeePay,
|
|
113
|
+
uint256 noncePay,
|
|
114
|
+
bytes memory signaturePay
|
|
110
115
|
) external;
|
|
111
116
|
function rejectProposalAdmin() external;
|
|
112
117
|
function rejectProposalEstimator() external;
|
package/interfaces/ITreasury.sol
CHANGED
|
@@ -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
|
|
13
|
+
function getCoreAddress() external view returns (address);
|
|
13
14
|
function withdraw(address token, uint256 amount) external;
|
|
14
15
|
}
|