@evvm/testnet-contracts 2.1.3 → 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.
- package/LICENSE +2 -2
- package/README.md +355 -55
- package/contracts/evvm/Evvm.sol +39 -38
- package/contracts/evvm/lib/ErrorsLib.sol +2 -1
- package/contracts/evvm/lib/EvvmStorage.sol +2 -0
- package/contracts/evvm/lib/EvvmStructs.sol +27 -1
- package/contracts/evvm/lib/SignatureUtils.sol +14 -17
- package/contracts/nameService/NameService.sol +124 -366
- package/contracts/nameService/lib/ErrorsLib.sol +2 -8
- package/contracts/nameService/lib/IdentityValidation.sol +182 -0
- package/contracts/nameService/lib/NameServiceStructs.sol +69 -0
- package/contracts/nameService/lib/SignatureUtils.sol +47 -41
- package/contracts/p2pSwap/P2PSwap.sol +54 -535
- package/contracts/p2pSwap/lib/P2PSwapStructs.sol +59 -0
- package/contracts/p2pSwap/lib/SignatureUtils.sol +16 -18
- package/contracts/staking/Estimator.sol +7 -6
- package/contracts/staking/Staking.sol +70 -159
- package/contracts/staking/lib/ErrorsLib.sol +0 -1
- package/contracts/staking/lib/SignatureUtils.sol +7 -36
- package/contracts/staking/lib/StakingStructs.sol +94 -0
- package/contracts/treasury/Treasury.sol +18 -20
- package/contracts/treasuryTwoChains/TreasuryExternalChainStation.sol +88 -35
- package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +81 -47
- package/contracts/treasuryTwoChains/lib/ErrorsLib.sol +2 -0
- package/contracts/treasuryTwoChains/lib/ExternalChainStationStructs.sol +3 -14
- package/contracts/treasuryTwoChains/lib/HostChainStationStructs.sol +3 -7
- package/contracts/treasuryTwoChains/lib/SignatureUtils.sol +12 -14
- package/interfaces/IEstimator.sol +7 -50
- package/interfaces/IEvvm.sol +17 -91
- package/interfaces/INameService.sol +37 -88
- package/interfaces/IP2PSwap.sol +19 -15
- package/interfaces/IStaking.sol +20 -50
- package/interfaces/ITreasury.sol +1 -4
- package/interfaces/ITreasuryExternalChainStation.sol +11 -15
- package/interfaces/ITreasuryHostChainStation.sol +7 -10
- package/library/Erc191TestBuilder.sol +56 -57
- package/library/EvvmService.sol +40 -0
- package/library/primitives/IERC20.sol +79 -0
- package/library/primitives/Math.sol +415 -0
- package/library/primitives/SignatureRecover.sol +42 -0
- package/library/utils/AdvancedStrings.sol +89 -0
- package/library/utils/GovernanceUtils.sol +81 -0
- package/library/utils/SignatureUtil.sol +29 -0
- package/library/utils/nonces/AsyncNonce.sol +32 -0
- package/library/utils/nonces/SyncNonce.sol +27 -0
- package/library/utils/service/EvvmPayments.sol +77 -0
- package/library/utils/service/StakingServiceUtils.sol +32 -0
- package/package.json +11 -13
- package/contracts/evvm/EvvmLegacy.sol +0 -1553
- package/library/AdvancedStrings.sol +0 -77
- package/library/SignatureRecover.sol +0 -140
- package/library/StakingServiceHooks.sol +0 -116
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
// SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
|
|
2
2
|
// Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
|
|
3
|
-
|
|
4
|
-
import {SignatureRecover} from "@evvm/testnet-contracts/library/SignatureRecover.sol";
|
|
5
|
-
import {AdvancedStrings} from "@evvm/testnet-contracts/library/AdvancedStrings.sol";
|
|
6
|
-
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
|
|
7
|
-
|
|
8
3
|
pragma solidity ^0.8.0;
|
|
9
4
|
|
|
5
|
+
import {SignatureUtil} from "@evvm/testnet-contracts/library/utils/SignatureUtil.sol";
|
|
6
|
+
import {AdvancedStrings} from "@evvm/testnet-contracts/library/utils/AdvancedStrings.sol";
|
|
7
|
+
|
|
10
8
|
/**
|
|
11
9
|
* @title SignatureUtils
|
|
12
10
|
* @author Mate labs
|
|
13
11
|
* @notice Signature verification utilities for Treasury Cross-Chain Fisher Bridge operations
|
|
14
12
|
* @dev Specialized signature verification for Fisher Bridge transactions in the EVVM cross-chain treasury system
|
|
15
13
|
* Provides EIP-191 compliant signature verification with structured message format for enhanced security
|
|
16
|
-
*
|
|
14
|
+
*
|
|
17
15
|
* Key Features:
|
|
18
16
|
* - EIP-191 standard message signing format for wallet compatibility
|
|
19
17
|
* - Fisher Bridge specific message structure for transaction authenticity
|
|
20
18
|
* - Nonce-based replay attack prevention
|
|
21
19
|
* - EVVM ID integration for cross-instance security
|
|
22
20
|
* - Support for both ETH and ERC20 token bridge operations
|
|
23
|
-
*
|
|
21
|
+
*
|
|
24
22
|
* Security Model:
|
|
25
23
|
* - Structured message format: "{evvmID},fisherBridge,{parameters}"
|
|
26
24
|
* - Nonce validation prevents replay attacks across chains
|
|
@@ -32,7 +30,7 @@ library SignatureUtils {
|
|
|
32
30
|
/// @dev Constructs and verifies structured message for Fisher Bridge cross-chain operations
|
|
33
31
|
/// Message format: "{evvmID},fisherBridge,{addressToReceive},{nonce},{tokenAddress},{priorityFee},{amount}"
|
|
34
32
|
/// This ensures each signature is unique and prevents cross-chain replay attacks
|
|
35
|
-
///
|
|
33
|
+
///
|
|
36
34
|
/// @param evvmID Unique identifier of the EVVM instance (prevents cross-instance replay)
|
|
37
35
|
/// @param signer Address that should have signed the message (transaction originator)
|
|
38
36
|
/// @param addressToReceive Destination address on the target chain for the bridged tokens
|
|
@@ -42,7 +40,7 @@ library SignatureUtils {
|
|
|
42
40
|
/// @param amount Total amount of tokens being bridged across chains
|
|
43
41
|
/// @param signature ECDSA signature (65 bytes) created by the signer using their private key
|
|
44
42
|
/// @return bool True if the signature is valid and matches the expected signer, false otherwise
|
|
45
|
-
///
|
|
43
|
+
///
|
|
46
44
|
/// @dev Security Features:
|
|
47
45
|
/// - EIP-191 compliance ensures wallet compatibility (MetaMask, WalletConnect, etc.)
|
|
48
46
|
/// - Structured message prevents parameter manipulation
|
|
@@ -60,19 +58,19 @@ library SignatureUtils {
|
|
|
60
58
|
bytes memory signature
|
|
61
59
|
) internal pure returns (bool) {
|
|
62
60
|
return
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
SignatureUtil.verifySignature(
|
|
62
|
+
evvmID,
|
|
65
63
|
"fisherBridge",
|
|
66
64
|
string.concat(
|
|
67
65
|
AdvancedStrings.addressToString(addressToReceive),
|
|
68
66
|
",",
|
|
69
|
-
|
|
67
|
+
AdvancedStrings.uintToString(nonce),
|
|
70
68
|
",",
|
|
71
69
|
AdvancedStrings.addressToString(tokenAddress),
|
|
72
70
|
",",
|
|
73
|
-
|
|
71
|
+
AdvancedStrings.uintToString(priorityFee),
|
|
74
72
|
",",
|
|
75
|
-
|
|
73
|
+
AdvancedStrings.uintToString(amount)
|
|
76
74
|
),
|
|
77
75
|
signature,
|
|
78
76
|
signer
|
|
@@ -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
|
|
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
|
|
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 (
|
package/interfaces/IEvvm.sol
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
119
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
85
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
) external view returns (
|
|
109
|
-
function
|
|
110
|
-
|
|
111
|
-
) external view returns (
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
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
|
|
128
|
-
function
|
|
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 (
|
|
138
|
-
function
|
|
110
|
+
returns (string memory);
|
|
111
|
+
function getSingleOfferOfUsername(string memory _username, uint256 _offerID)
|
|
139
112
|
external
|
|
140
113
|
view
|
|
141
|
-
returns (
|
|
142
|
-
|
|
143
|
-
|
|
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
|
-
|
|
219
|
-
) external view returns (
|
|
220
|
-
function
|
|
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,
|
package/interfaces/IP2PSwap.sol
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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,
|