@evvm/testnet-contracts 2.0.2 → 2.0.4

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.
@@ -299,7 +299,7 @@ contract NameService {
299
299
 
300
300
  makePay(
301
301
  user,
302
- getPricePerRegistration(),
302
+ getPriceOfRegistration(username),
303
303
  priorityFee_EVVM,
304
304
  nonce_EVVM,
305
305
  priorityFlag_EVVM,
@@ -1659,12 +1659,20 @@ contract NameService {
1659
1659
  }
1660
1660
 
1661
1661
  /**
1662
- * @notice Gets the current price for registering a new username
1663
- * @dev Price is dynamic and based on current EVVM reward amount (100x reward)
1662
+ * @notice Gets price to register an username
1663
+ * @dev Price is fully dynamic based on existing offers and timing
1664
+ * - If dosnt have offers, price is 100x current EVVM reward amount
1665
+ * - If has offers, price is calculated via seePriceToRenew function
1666
+ * @param username The username to get registration price for
1664
1667
  * @return The current registration price in Principal Tokens
1665
1668
  */
1666
- function getPricePerRegistration() public view returns (uint256) {
1667
- return Evvm(evvmAddress.current).getRewardAmount() * 100;
1669
+ function getPriceOfRegistration(
1670
+ string memory username
1671
+ ) public view returns (uint256) {
1672
+ return
1673
+ identityDetails[username].offerMaxSlots > 0
1674
+ ? seePriceToRenew(username)
1675
+ : Evvm(evvmAddress.current).getRewardAmount() * 100;
1668
1676
  }
1669
1677
 
1670
1678
  //█ Administrative Getters ███████████████████████████████████████████████████████████████████████
@@ -1,9 +1,7 @@
1
- // SPDX-License-Identifier: EVVM-NONCOMMERCIAL-1.0
2
- // Full license terms available at: https://www.evvm.info/docs/EVVMNoncommercialLicense
1
+ // SPDX-License-Identifier: UNLICENSED
2
+ pragma solidity ^0.8.4;
3
3
 
4
- pragma solidity ^0.8.0;
5
-
6
- interface INameService {
4
+ interface NameService {
7
5
  struct OfferMetadata {
8
6
  address offerer;
9
7
  uint256 expireDate;
@@ -25,7 +23,6 @@ interface INameService {
25
23
  error UsernameAlreadyRegistered();
26
24
 
27
25
  function acceptChangeEvvmAddress() external;
28
-
29
26
  function acceptOffer(
30
27
  address user,
31
28
  string memory username,
@@ -37,9 +34,7 @@ interface INameService {
37
34
  bool priorityFlag_EVVM,
38
35
  bytes memory signature_EVVM
39
36
  ) external;
40
-
41
37
  function acceptProposeAdmin() external;
42
-
43
38
  function addCustomMetadata(
44
39
  address user,
45
40
  string memory identity,
@@ -51,20 +46,14 @@ interface INameService {
51
46
  bool priorityFlag_EVVM,
52
47
  bytes memory signature_EVVM
53
48
  ) external;
54
-
55
49
  function cancelChangeEvvmAddress() external;
56
-
57
50
  function cancelProposeAdmin() external;
58
-
59
51
  function cancelWithdrawPrincipalTokens() external;
60
-
61
52
  function checkIfNameServiceNonceIsAvailable(
62
53
  address _user,
63
54
  uint256 _nonce
64
55
  ) external view returns (bool);
65
-
66
56
  function claimWithdrawPrincipalTokens() external;
67
-
68
57
  function flushCustomMetadata(
69
58
  address user,
70
59
  string memory identity,
@@ -75,7 +64,6 @@ interface INameService {
75
64
  bool priorityFlag_EVVM,
76
65
  bytes memory signature_EVVM
77
66
  ) external;
78
-
79
67
  function flushUsername(
80
68
  address user,
81
69
  string memory username,
@@ -86,9 +74,7 @@ interface INameService {
86
74
  bool priorityFlag_EVVM,
87
75
  bytes memory signature_EVVM
88
76
  ) external;
89
-
90
77
  function getAdmin() external view returns (address);
91
-
92
78
  function getAdminFullDetails()
93
79
  external
94
80
  view
@@ -97,17 +83,13 @@ interface INameService {
97
83
  address proposalAdmin,
98
84
  uint256 timeToAcceptAdmin
99
85
  );
100
-
101
86
  function getAmountOfCustomMetadata(
102
87
  string memory _username
103
88
  ) external view returns (uint256);
104
-
105
89
  function getCustomMetadataMaxSlotsOfIdentity(
106
90
  string memory _username
107
91
  ) external view returns (uint256);
108
-
109
92
  function getEvvmAddress() external view returns (address);
110
-
111
93
  function getEvvmAddressFullDetails()
112
94
  external
113
95
  view
@@ -116,51 +98,41 @@ interface INameService {
116
98
  address proposalEvvmAddress,
117
99
  uint256 timeToAcceptEvvmAddress
118
100
  );
119
-
120
101
  function getExpireDateOfIdentity(
121
102
  string memory _identity
122
103
  ) external view returns (uint256);
123
-
124
104
  function getFullCustomMetadataOfIdentity(
125
105
  string memory _username
126
106
  ) external view returns (string[] memory);
127
-
128
107
  function getIdentityBasicMetadata(
129
108
  string memory _username
130
109
  ) external view returns (address, uint256);
131
-
132
110
  function getLengthOfOffersUsername(
133
111
  string memory _username
134
112
  ) external view returns (uint256 length);
135
-
136
113
  function getOffersOfUsername(
137
114
  string memory _username
138
115
  ) external view returns (OfferMetadata[] memory offers);
139
-
140
116
  function getOwnerOfIdentity(
141
117
  string memory _username
142
118
  ) external view returns (address);
143
-
144
- function getPricePerRegistration() external view returns (uint256);
145
-
119
+ function getPriceOfRegistration(
120
+ string memory username
121
+ ) external view returns (uint256);
146
122
  function getPriceToAddCustomMetadata()
147
123
  external
148
124
  view
149
125
  returns (uint256 price);
150
-
151
126
  function getPriceToFlushCustomMetadata(
152
127
  string memory _identity
153
128
  ) external view returns (uint256 price);
154
-
155
129
  function getPriceToFlushUsername(
156
130
  string memory _identity
157
131
  ) external view returns (uint256 price);
158
-
159
132
  function getPriceToRemoveCustomMetadata()
160
133
  external
161
134
  view
162
135
  returns (uint256 price);
163
-
164
136
  function getProposedWithdrawAmountFullDetails()
165
137
  external
166
138
  view
@@ -168,26 +140,21 @@ interface INameService {
168
140
  uint256 proposalAmountToWithdrawTokens,
169
141
  uint256 timeToAcceptAmountToWithdrawTokens
170
142
  );
171
-
172
143
  function getSingleCustomMetadataOfIdentity(
173
144
  string memory _username,
174
145
  uint256 _key
175
146
  ) external view returns (string memory);
176
-
177
147
  function getSingleOfferOfUsername(
178
148
  string memory _username,
179
149
  uint256 _offerID
180
150
  ) external view returns (OfferMetadata memory offer);
181
-
182
151
  function hashUsername(
183
152
  string memory _username,
184
153
  uint256 _randomNumber
185
154
  ) external pure returns (bytes32);
186
-
187
155
  function isUsernameAvailable(
188
156
  string memory _username
189
157
  ) external view returns (bool);
190
-
191
158
  function makeOffer(
192
159
  address user,
193
160
  string memory username,
@@ -200,7 +167,6 @@ interface INameService {
200
167
  bool priorityFlag_EVVM,
201
168
  bytes memory signature_EVVM
202
169
  ) external returns (uint256 offerID);
203
-
204
170
  function preRegistrationUsername(
205
171
  address user,
206
172
  bytes32 hashPreRegisteredUsername,
@@ -211,13 +177,9 @@ interface INameService {
211
177
  bool priorityFlag_EVVM,
212
178
  bytes memory signature_EVVM
213
179
  ) external;
214
-
215
180
  function proposeAdmin(address _adminToPropose) external;
216
-
217
181
  function proposeChangeEvvmAddress(address _newEvvmAddress) external;
218
-
219
182
  function proposeWithdrawPrincipalTokens(uint256 _amount) external;
220
-
221
183
  function registrationUsername(
222
184
  address user,
223
185
  string memory username,
@@ -229,7 +191,6 @@ interface INameService {
229
191
  bool priorityFlag_EVVM,
230
192
  bytes memory signature_EVVM
231
193
  ) external;
232
-
233
194
  function removeCustomMetadata(
234
195
  address user,
235
196
  string memory identity,
@@ -241,7 +202,6 @@ interface INameService {
241
202
  bool priorityFlag_EVVM,
242
203
  bytes memory signature_EVVM
243
204
  ) external;
244
-
245
205
  function renewUsername(
246
206
  address user,
247
207
  string memory username,
@@ -252,23 +212,18 @@ interface INameService {
252
212
  bool priorityFlag_EVVM,
253
213
  bytes memory signature_EVVM
254
214
  ) external;
255
-
256
215
  function seePriceToRenew(
257
216
  string memory _identity
258
217
  ) external view returns (uint256 price);
259
-
260
218
  function strictVerifyIfIdentityExist(
261
219
  string memory _username
262
220
  ) external view returns (bool);
263
-
264
221
  function verifyIfIdentityExists(
265
222
  string memory _identity
266
223
  ) external view returns (bool);
267
-
268
224
  function verifyStrictAndGetOwnerOfIdentity(
269
225
  string memory _username
270
226
  ) external view returns (address answer);
271
-
272
227
  function withdrawOffer(
273
228
  address user,
274
229
  string memory username,
@@ -59,7 +59,7 @@ abstract contract StakingServiceHooks {
59
59
  * @dev CRITICAL: This function ensures atomicity - if any step fails, the entire transaction reverts
60
60
  * preventing the loss of Principal Tokens that could occur with manual step-by-step execution
61
61
  */
62
- function makeStakeService(uint256 amountToStake) internal {
62
+ function _makeStakeService(uint256 amountToStake) internal {
63
63
  Staking(stakingHookAddress).prepareServiceStaking(amountToStake);
64
64
  Evvm(evvmHookAddress).caPay(
65
65
  address(stakingHookAddress),
@@ -84,7 +84,7 @@ abstract contract StakingServiceHooks {
84
84
  *
85
85
  * @dev Unstaking is subject to the same time locks as regular user unstaking
86
86
  */
87
- function makeUnstakeService(uint256 amountToUnstake) internal {
87
+ function _makeUnstakeService(uint256 amountToUnstake) internal {
88
88
  Staking(stakingHookAddress).serviceUnstaking(amountToUnstake);
89
89
  }
90
90
 
@@ -110,7 +110,7 @@ abstract contract StakingServiceHooks {
110
110
  * is upgraded but the staking contract remains the same. In most cases, prefer
111
111
  * using _changeStakingHookAddress which updates both addresses automatically.
112
112
  */
113
- function changeEvvmHookAddress(address newEvvmAddress) internal {
113
+ function _changeEvvmHookAddress(address newEvvmAddress) internal {
114
114
  evvmHookAddress = newEvvmAddress;
115
115
  }
116
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evvm/testnet-contracts",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "EVVM Testnet Contracts - Smart contracts and tools for scalable, modular, and cross-chain EVM virtualization",
5
5
  "files": [
6
6
  "contracts/**/*.sol",