@evvm/testnet-contracts 2.2.3 → 2.3.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 +138 -35
- package/contracts/evvm/Evvm.sol +154 -181
- package/contracts/evvm/lib/ErrorsLib.sol +119 -6
- package/contracts/evvm/lib/EvvmStorage.sol +164 -9
- package/contracts/evvm/lib/EvvmStructs.sol +124 -6
- package/contracts/evvm/lib/SignatureUtils.sol +103 -61
- package/contracts/nameService/NameService.sol +165 -155
- package/contracts/nameService/lib/ErrorsLib.sol +142 -8
- package/contracts/nameService/lib/IdentityValidation.sol +21 -0
- package/contracts/nameService/lib/NameServiceStructs.sol +75 -19
- package/contracts/nameService/lib/SignatureUtils.sol +235 -60
- package/contracts/p2pSwap/P2PSwap.sol +201 -160
- package/contracts/staking/Estimator.sol +131 -24
- package/contracts/staking/Staking.sol +98 -113
- package/contracts/staking/lib/ErrorsLib.sol +79 -3
- package/contracts/staking/lib/SignatureUtils.sol +82 -16
- package/contracts/staking/lib/StakingStructs.sol +12 -0
- package/contracts/treasury/Treasury.sol +30 -12
- package/contracts/treasury/lib/ErrorsLib.sol +30 -0
- package/contracts/treasuryTwoChains/TreasuryHostChainStation.sol +3 -3
- package/interfaces/IEvvm.sol +9 -4
- package/interfaces/INameService.sol +12 -3
- package/interfaces/IStaking.sol +2 -1
- package/library/Erc191TestBuilder.sol +188 -0
- package/library/EvvmService.sol +55 -0
- package/library/primitives/SignatureRecover.sol +33 -0
- package/library/utils/AdvancedStrings.sol +61 -0
- package/library/utils/SignatureUtil.sol +34 -0
- package/library/utils/nonces/AsyncNonce.sol +42 -0
- package/library/utils/nonces/SyncNonce.sol +44 -0
- package/library/utils/service/EvvmPayments.sol +65 -0
- package/library/utils/service/StakingServiceUtils.sol +44 -0
- package/package.json +2 -1
|
@@ -2,21 +2,60 @@
|
|
|
2
2
|
// Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
SignatureUtil
|
|
7
|
+
} from "@evvm/testnet-contracts/library/utils/SignatureUtil.sol";
|
|
8
|
+
import {
|
|
9
|
+
AdvancedStrings
|
|
10
|
+
} from "@evvm/testnet-contracts/library/utils/AdvancedStrings.sol";
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @title SignatureUtils
|
|
14
|
+
* @author Mate labs
|
|
15
|
+
* @notice Library for EIP-191 signature verification exclusively for NameService.sol operations
|
|
16
|
+
* @dev This library provides signature verification utilities for all NameService.sol operations,
|
|
17
|
+
* including username registration, marketplace offers, custom metadata management, and
|
|
18
|
+
* administrative functions. It constructs deterministic message formats and validates signatures.
|
|
19
|
+
*
|
|
20
|
+
* Signature Verification:
|
|
21
|
+
* - Uses EIP-191 standard for message signing and verification
|
|
22
|
+
* - Constructs deterministic message strings from operation parameters
|
|
23
|
+
* - Integrates with SignatureUtil for cryptographic verification
|
|
24
|
+
* - Prevents replay attacks through nonce inclusion
|
|
25
|
+
* - Supports cross-chain safety through EvvmID inclusion
|
|
26
|
+
*
|
|
27
|
+
* Operation Types:
|
|
28
|
+
* - Registration: preRegistrationUsername, registrationUsername
|
|
29
|
+
* - Marketplace: makeOffer, withdrawOffer, acceptOffer
|
|
30
|
+
* - Renewal: renewUsername
|
|
31
|
+
* - Metadata: addCustomMetadata, removeCustomMetadata, flushCustomMetadata
|
|
32
|
+
* - Management: flushUsername
|
|
33
|
+
*
|
|
34
|
+
* @custom:scope Exclusive to NameService.sol operations
|
|
35
|
+
* @custom:standard EIP-191 (https://eips.ethereum.org/EIPS/eip-191)
|
|
36
|
+
* @custom:security All signatures include EvvmID to prevent cross-chain replay attacks
|
|
37
|
+
*/
|
|
8
38
|
library SignatureUtils {
|
|
39
|
+
|
|
9
40
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
41
|
+
* @notice Verifies EIP-191 signature for username pre-registration operations
|
|
42
|
+
* @dev Constructs message from hash and nonce, verifies against signer
|
|
43
|
+
*
|
|
44
|
+
* Message Format: "[hashUsername],[nameServiceNonce]"
|
|
45
|
+
* Used in: preRegistrationUsername function
|
|
46
|
+
*
|
|
47
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
48
|
+
* @param signer Address that signed the message (user pre-registering)
|
|
49
|
+
* @param hashUsername Keccak256 hash of username + random number for commitment
|
|
50
|
+
* @param nameServiceNonce Transaction nonce for replay protection
|
|
51
|
+
* @param signature EIP-191 signature from the signer
|
|
52
|
+
* @return bool True if the signature is valid and matches the signer
|
|
13
53
|
*/
|
|
14
|
-
|
|
15
54
|
function verifyMessageSignedForPreRegistrationUsername(
|
|
16
55
|
uint256 evvmID,
|
|
17
56
|
address signer,
|
|
18
|
-
bytes32
|
|
19
|
-
uint256
|
|
57
|
+
bytes32 hashUsername,
|
|
58
|
+
uint256 nameServiceNonce,
|
|
20
59
|
bytes memory signature
|
|
21
60
|
) internal pure returns (bool) {
|
|
22
61
|
return
|
|
@@ -24,21 +63,37 @@ library SignatureUtils {
|
|
|
24
63
|
evvmID,
|
|
25
64
|
"preRegistrationUsername",
|
|
26
65
|
string.concat(
|
|
27
|
-
AdvancedStrings.bytes32ToString(
|
|
66
|
+
AdvancedStrings.bytes32ToString(hashUsername),
|
|
28
67
|
",",
|
|
29
|
-
AdvancedStrings.uintToString(
|
|
68
|
+
AdvancedStrings.uintToString(nameServiceNonce)
|
|
30
69
|
),
|
|
31
70
|
signature,
|
|
32
71
|
signer
|
|
33
72
|
);
|
|
34
73
|
}
|
|
35
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @notice Verifies EIP-191 signature for username registration operations
|
|
77
|
+
* @dev Constructs message from username, random number, and nonce
|
|
78
|
+
*
|
|
79
|
+
* Message Format: "[username],[clowNumber],[nameServiceNonce]"
|
|
80
|
+
* Used in: registrationUsername function
|
|
81
|
+
* Reveals the username from pre-registration commitment
|
|
82
|
+
*
|
|
83
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
84
|
+
* @param signer Address that signed the message (user registering)
|
|
85
|
+
* @param username The actual username being registered
|
|
86
|
+
* @param clowNumber Random number used in pre-registration hash
|
|
87
|
+
* @param nameServiceNonce Transaction nonce for replay protection
|
|
88
|
+
* @param signature EIP-191 signature from the signer
|
|
89
|
+
* @return bool True if the signature is valid and matches the signer
|
|
90
|
+
*/
|
|
36
91
|
function verifyMessageSignedForRegistrationUsername(
|
|
37
92
|
uint256 evvmID,
|
|
38
93
|
address signer,
|
|
39
|
-
string memory
|
|
40
|
-
uint256
|
|
41
|
-
uint256
|
|
94
|
+
string memory username,
|
|
95
|
+
uint256 clowNumber,
|
|
96
|
+
uint256 nameServiceNonce,
|
|
42
97
|
bytes memory signature
|
|
43
98
|
) internal pure returns (bool) {
|
|
44
99
|
return
|
|
@@ -46,24 +101,40 @@ library SignatureUtils {
|
|
|
46
101
|
evvmID,
|
|
47
102
|
"registrationUsername",
|
|
48
103
|
string.concat(
|
|
49
|
-
|
|
104
|
+
username,
|
|
50
105
|
",",
|
|
51
|
-
AdvancedStrings.uintToString(
|
|
106
|
+
AdvancedStrings.uintToString(clowNumber),
|
|
52
107
|
",",
|
|
53
|
-
AdvancedStrings.uintToString(
|
|
108
|
+
AdvancedStrings.uintToString(nameServiceNonce)
|
|
54
109
|
),
|
|
55
110
|
signature,
|
|
56
111
|
signer
|
|
57
112
|
);
|
|
58
113
|
}
|
|
59
114
|
|
|
115
|
+
/**
|
|
116
|
+
* @notice Verifies EIP-191 signature for creating marketplace offers
|
|
117
|
+
* @dev Constructs message from username, expiration, amount, and nonce
|
|
118
|
+
*
|
|
119
|
+
* Message Format: "[username],[dateExpire],[amount],[nameServiceNonce]"
|
|
120
|
+
* Used in: makeOffer function
|
|
121
|
+
*
|
|
122
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
123
|
+
* @param signer Address that signed the message (offerer)
|
|
124
|
+
* @param username Target username for the offer
|
|
125
|
+
* @param dateExpire Timestamp when the offer expires
|
|
126
|
+
* @param amount Amount being offered in Principal Tokens
|
|
127
|
+
* @param nameServiceNonce Transaction nonce for replay protection
|
|
128
|
+
* @param signature EIP-191 signature from the signer
|
|
129
|
+
* @return bool True if the signature is valid and matches the signer
|
|
130
|
+
*/
|
|
60
131
|
function verifyMessageSignedForMakeOffer(
|
|
61
132
|
uint256 evvmID,
|
|
62
133
|
address signer,
|
|
63
|
-
string memory
|
|
64
|
-
uint256
|
|
65
|
-
uint256
|
|
66
|
-
uint256
|
|
134
|
+
string memory username,
|
|
135
|
+
uint256 dateExpire,
|
|
136
|
+
uint256 amount,
|
|
137
|
+
uint256 nameServiceNonce,
|
|
67
138
|
bytes memory signature
|
|
68
139
|
) internal pure returns (bool) {
|
|
69
140
|
return
|
|
@@ -71,25 +142,40 @@ library SignatureUtils {
|
|
|
71
142
|
evvmID,
|
|
72
143
|
"makeOffer",
|
|
73
144
|
string.concat(
|
|
74
|
-
|
|
145
|
+
username,
|
|
75
146
|
",",
|
|
76
|
-
AdvancedStrings.uintToString(
|
|
147
|
+
AdvancedStrings.uintToString(dateExpire),
|
|
77
148
|
",",
|
|
78
|
-
AdvancedStrings.uintToString(
|
|
149
|
+
AdvancedStrings.uintToString(amount),
|
|
79
150
|
",",
|
|
80
|
-
AdvancedStrings.uintToString(
|
|
151
|
+
AdvancedStrings.uintToString(nameServiceNonce)
|
|
81
152
|
),
|
|
82
153
|
signature,
|
|
83
154
|
signer
|
|
84
155
|
);
|
|
85
156
|
}
|
|
86
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @notice Verifies EIP-191 signature for withdrawing marketplace offers
|
|
160
|
+
* @dev Constructs message from username, offer ID, and nonce
|
|
161
|
+
*
|
|
162
|
+
* Message Format: "[username],[offerId],[nameServiceNonce]"
|
|
163
|
+
* Used in: withdrawOffer function
|
|
164
|
+
*
|
|
165
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
166
|
+
* @param signer Address that signed the message (offerer withdrawing)
|
|
167
|
+
* @param username Username the offer was made for
|
|
168
|
+
* @param offerId Unique identifier of the offer to withdraw
|
|
169
|
+
* @param nameServiceNonce Transaction nonce for replay protection
|
|
170
|
+
* @param signature EIP-191 signature from the signer
|
|
171
|
+
* @return bool True if the signature is valid and matches the signer
|
|
172
|
+
*/
|
|
87
173
|
function verifyMessageSignedForWithdrawOffer(
|
|
88
174
|
uint256 evvmID,
|
|
89
175
|
address signer,
|
|
90
|
-
string memory
|
|
91
|
-
uint256
|
|
92
|
-
uint256
|
|
176
|
+
string memory username,
|
|
177
|
+
uint256 offerId,
|
|
178
|
+
uint256 nameServiceNonce,
|
|
93
179
|
bytes memory signature
|
|
94
180
|
) internal pure returns (bool) {
|
|
95
181
|
return
|
|
@@ -97,23 +183,38 @@ library SignatureUtils {
|
|
|
97
183
|
evvmID,
|
|
98
184
|
"withdrawOffer",
|
|
99
185
|
string.concat(
|
|
100
|
-
|
|
186
|
+
username,
|
|
101
187
|
",",
|
|
102
|
-
AdvancedStrings.uintToString(
|
|
188
|
+
AdvancedStrings.uintToString(offerId),
|
|
103
189
|
",",
|
|
104
|
-
AdvancedStrings.uintToString(
|
|
190
|
+
AdvancedStrings.uintToString(nameServiceNonce)
|
|
105
191
|
),
|
|
106
192
|
signature,
|
|
107
193
|
signer
|
|
108
194
|
);
|
|
109
195
|
}
|
|
110
196
|
|
|
197
|
+
/**
|
|
198
|
+
* @notice Verifies EIP-191 signature for accepting marketplace offers
|
|
199
|
+
* @dev Constructs message from username, offer ID, and nonce
|
|
200
|
+
*
|
|
201
|
+
* Message Format: "[username],[offerId],[nameServiceNonce]"
|
|
202
|
+
* Used in: acceptOffer function
|
|
203
|
+
*
|
|
204
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
205
|
+
* @param signer Address that signed the message (username owner accepting)
|
|
206
|
+
* @param username Username being sold
|
|
207
|
+
* @param offerId Unique identifier of the offer to accept
|
|
208
|
+
* @param nameServiceNonce Transaction nonce for replay protection
|
|
209
|
+
* @param signature EIP-191 signature from the signer
|
|
210
|
+
* @return bool True if the signature is valid and matches the signer
|
|
211
|
+
*/
|
|
111
212
|
function verifyMessageSignedForAcceptOffer(
|
|
112
213
|
uint256 evvmID,
|
|
113
214
|
address signer,
|
|
114
|
-
string memory
|
|
115
|
-
uint256
|
|
116
|
-
uint256
|
|
215
|
+
string memory username,
|
|
216
|
+
uint256 offerId,
|
|
217
|
+
uint256 nameServiceNonce,
|
|
117
218
|
bytes memory signature
|
|
118
219
|
) internal pure returns (bool) {
|
|
119
220
|
return
|
|
@@ -121,22 +222,36 @@ library SignatureUtils {
|
|
|
121
222
|
evvmID,
|
|
122
223
|
"acceptOffer",
|
|
123
224
|
string.concat(
|
|
124
|
-
|
|
225
|
+
username,
|
|
125
226
|
",",
|
|
126
|
-
AdvancedStrings.uintToString(
|
|
227
|
+
AdvancedStrings.uintToString(offerId),
|
|
127
228
|
",",
|
|
128
|
-
AdvancedStrings.uintToString(
|
|
229
|
+
AdvancedStrings.uintToString(nameServiceNonce)
|
|
129
230
|
),
|
|
130
231
|
signature,
|
|
131
232
|
signer
|
|
132
233
|
);
|
|
133
234
|
}
|
|
134
235
|
|
|
236
|
+
/**
|
|
237
|
+
* @notice Verifies EIP-191 signature for username renewal operations
|
|
238
|
+
* @dev Constructs message from username and nonce
|
|
239
|
+
*
|
|
240
|
+
* Message Format: "[username],[nameServiceNonce]"
|
|
241
|
+
* Used in: renewUsername function
|
|
242
|
+
*
|
|
243
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
244
|
+
* @param signer Address that signed the message (username owner)
|
|
245
|
+
* @param username Username to renew
|
|
246
|
+
* @param nameServiceNonce Transaction nonce for replay protection
|
|
247
|
+
* @param signature EIP-191 signature from the signer
|
|
248
|
+
* @return bool True if the signature is valid and matches the signer
|
|
249
|
+
*/
|
|
135
250
|
function verifyMessageSignedForRenewUsername(
|
|
136
251
|
uint256 evvmID,
|
|
137
252
|
address signer,
|
|
138
|
-
string memory
|
|
139
|
-
uint256
|
|
253
|
+
string memory username,
|
|
254
|
+
uint256 nameServiceNonce,
|
|
140
255
|
bytes memory signature
|
|
141
256
|
) internal pure returns (bool) {
|
|
142
257
|
return
|
|
@@ -144,21 +259,36 @@ library SignatureUtils {
|
|
|
144
259
|
evvmID,
|
|
145
260
|
"renewUsername",
|
|
146
261
|
string.concat(
|
|
147
|
-
|
|
262
|
+
username,
|
|
148
263
|
",",
|
|
149
|
-
AdvancedStrings.uintToString(
|
|
264
|
+
AdvancedStrings.uintToString(nameServiceNonce)
|
|
150
265
|
),
|
|
151
266
|
signature,
|
|
152
267
|
signer
|
|
153
268
|
);
|
|
154
269
|
}
|
|
155
270
|
|
|
271
|
+
/**
|
|
272
|
+
* @notice Verifies EIP-191 signature for adding custom metadata to identity
|
|
273
|
+
* @dev Constructs message from identity, metadata value, and nonce
|
|
274
|
+
*
|
|
275
|
+
* Message Format: "[identity],[value],[nameServiceNonce]"
|
|
276
|
+
* Used in: addCustomMetadata function
|
|
277
|
+
*
|
|
278
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
279
|
+
* @param signer Address that signed the message (identity owner)
|
|
280
|
+
* @param identity Username/identity to add metadata to
|
|
281
|
+
* @param value Metadata value in format: [schema]:[subschema]>[value]
|
|
282
|
+
* @param nameServiceNonce Transaction nonce for replay protection
|
|
283
|
+
* @param signature EIP-191 signature from the signer
|
|
284
|
+
* @return bool True if the signature is valid and matches the signer
|
|
285
|
+
*/
|
|
156
286
|
function verifyMessageSignedForAddCustomMetadata(
|
|
157
287
|
uint256 evvmID,
|
|
158
288
|
address signer,
|
|
159
|
-
string memory
|
|
160
|
-
string memory
|
|
161
|
-
uint256
|
|
289
|
+
string memory identity,
|
|
290
|
+
string memory value,
|
|
291
|
+
uint256 nameServiceNonce,
|
|
162
292
|
bytes memory signature
|
|
163
293
|
) internal pure returns (bool) {
|
|
164
294
|
return
|
|
@@ -166,23 +296,38 @@ library SignatureUtils {
|
|
|
166
296
|
evvmID,
|
|
167
297
|
"addCustomMetadata",
|
|
168
298
|
string.concat(
|
|
169
|
-
|
|
299
|
+
identity,
|
|
170
300
|
",",
|
|
171
|
-
|
|
301
|
+
value,
|
|
172
302
|
",",
|
|
173
|
-
AdvancedStrings.uintToString(
|
|
303
|
+
AdvancedStrings.uintToString(nameServiceNonce)
|
|
174
304
|
),
|
|
175
305
|
signature,
|
|
176
306
|
signer
|
|
177
307
|
);
|
|
178
308
|
}
|
|
179
309
|
|
|
310
|
+
/**
|
|
311
|
+
* @notice Verifies EIP-191 signature for removing custom metadata from username
|
|
312
|
+
* @dev Constructs message from username, metadata key, and nonce
|
|
313
|
+
*
|
|
314
|
+
* Message Format: "[username],[key],[nonce]"
|
|
315
|
+
* Used in: removeCustomMetadata function
|
|
316
|
+
*
|
|
317
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
318
|
+
* @param signer Address that signed the message (username owner)
|
|
319
|
+
* @param username Username to remove metadata from
|
|
320
|
+
* @param key Index of the metadata entry to remove
|
|
321
|
+
* @param nonce Transaction nonce for replay protection
|
|
322
|
+
* @param signature EIP-191 signature from the signer
|
|
323
|
+
* @return bool True if the signature is valid and matches the signer
|
|
324
|
+
*/
|
|
180
325
|
function verifyMessageSignedForRemoveCustomMetadata(
|
|
181
326
|
uint256 evvmID,
|
|
182
327
|
address signer,
|
|
183
|
-
string memory
|
|
184
|
-
uint256
|
|
185
|
-
uint256
|
|
328
|
+
string memory username,
|
|
329
|
+
uint256 key,
|
|
330
|
+
uint256 nonce,
|
|
186
331
|
bytes memory signature
|
|
187
332
|
) internal pure returns (bool) {
|
|
188
333
|
return
|
|
@@ -190,22 +335,37 @@ library SignatureUtils {
|
|
|
190
335
|
evvmID,
|
|
191
336
|
"removeCustomMetadata",
|
|
192
337
|
string.concat(
|
|
193
|
-
|
|
338
|
+
username,
|
|
194
339
|
",",
|
|
195
|
-
AdvancedStrings.uintToString(
|
|
340
|
+
AdvancedStrings.uintToString(key),
|
|
196
341
|
",",
|
|
197
|
-
AdvancedStrings.uintToString(
|
|
342
|
+
AdvancedStrings.uintToString(nonce)
|
|
198
343
|
),
|
|
199
344
|
signature,
|
|
200
345
|
signer
|
|
201
346
|
);
|
|
202
347
|
}
|
|
203
348
|
|
|
349
|
+
/**
|
|
350
|
+
* @notice Verifies EIP-191 signature for flushing all custom metadata from identity
|
|
351
|
+
* @dev Constructs message from identity and nonce
|
|
352
|
+
*
|
|
353
|
+
* Message Format: "[identity],[nonce]"
|
|
354
|
+
* Used in: flushCustomMetadata function
|
|
355
|
+
* Removes all custom metadata entries at once
|
|
356
|
+
*
|
|
357
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
358
|
+
* @param signer Address that signed the message (identity owner)
|
|
359
|
+
* @param identity Username/identity to flush metadata from
|
|
360
|
+
* @param nonce Transaction nonce for replay protection
|
|
361
|
+
* @param signature EIP-191 signature from the signer
|
|
362
|
+
* @return bool True if the signature is valid and matches the signer
|
|
363
|
+
*/
|
|
204
364
|
function verifyMessageSignedForFlushCustomMetadata(
|
|
205
365
|
uint256 evvmID,
|
|
206
366
|
address signer,
|
|
207
|
-
string memory
|
|
208
|
-
uint256
|
|
367
|
+
string memory identity,
|
|
368
|
+
uint256 nonce,
|
|
209
369
|
bytes memory signature
|
|
210
370
|
) internal pure returns (bool) {
|
|
211
371
|
return
|
|
@@ -213,20 +373,35 @@ library SignatureUtils {
|
|
|
213
373
|
evvmID,
|
|
214
374
|
"flushCustomMetadata",
|
|
215
375
|
string.concat(
|
|
216
|
-
|
|
376
|
+
identity,
|
|
217
377
|
",",
|
|
218
|
-
AdvancedStrings.uintToString(
|
|
378
|
+
AdvancedStrings.uintToString(nonce)
|
|
219
379
|
),
|
|
220
380
|
signature,
|
|
221
381
|
signer
|
|
222
382
|
);
|
|
223
383
|
}
|
|
224
384
|
|
|
385
|
+
/**
|
|
386
|
+
* @notice Verifies EIP-191 signature for flushing/deleting a username entirely
|
|
387
|
+
* @dev Constructs message from username and nonce
|
|
388
|
+
*
|
|
389
|
+
* Message Format: "[username],[nonce]"
|
|
390
|
+
* Used in: flushUsername function
|
|
391
|
+
* Permanently removes username and all associated data
|
|
392
|
+
*
|
|
393
|
+
* @param evvmID Unique identifier of the EVVM instance for cross-chain safety
|
|
394
|
+
* @param signer Address that signed the message (username owner)
|
|
395
|
+
* @param username Username to flush/delete
|
|
396
|
+
* @param nonce Transaction nonce for replay protection
|
|
397
|
+
* @param signature EIP-191 signature from the signer
|
|
398
|
+
* @return bool True if the signature is valid and matches the signer
|
|
399
|
+
*/
|
|
225
400
|
function verifyMessageSignedForFlushUsername(
|
|
226
401
|
uint256 evvmID,
|
|
227
402
|
address signer,
|
|
228
|
-
string memory
|
|
229
|
-
uint256
|
|
403
|
+
string memory username,
|
|
404
|
+
uint256 nonce,
|
|
230
405
|
bytes memory signature
|
|
231
406
|
) internal pure returns (bool) {
|
|
232
407
|
return
|
|
@@ -234,9 +409,9 @@ library SignatureUtils {
|
|
|
234
409
|
evvmID,
|
|
235
410
|
"flushUsername",
|
|
236
411
|
string.concat(
|
|
237
|
-
|
|
412
|
+
username,
|
|
238
413
|
",",
|
|
239
|
-
AdvancedStrings.uintToString(
|
|
414
|
+
AdvancedStrings.uintToString(nonce)
|
|
240
415
|
),
|
|
241
416
|
signature,
|
|
242
417
|
signer
|