@rev-net/core-v6 0.0.33 → 0.0.35
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/ADMINISTRATION.md +38 -51
- package/ARCHITECTURE.md +24 -11
- package/AUDIT_INSTRUCTIONS.md +43 -80
- package/CHANGELOG.md +4 -3
- package/README.md +20 -32
- package/RISKS.md +49 -214
- package/SKILLS.md +10 -17
- package/USER_JOURNEYS.md +47 -66
- package/package.json +1 -1
- package/references/runtime.md +3 -2
- package/src/REVDeployer.sol +13 -2
- package/src/REVHiddenTokens.sol +48 -26
- package/src/REVLoans.sol +2 -2
- package/src/REVOwner.sol +10 -2
- package/src/interfaces/IREVHiddenTokens.sol +21 -6
- package/test/TestAuditFixVerification.t.sol +675 -0
- package/test/TestHiddenTokens.t.sol +51 -8
- package/test/TestTerminalEncodingInHash.t.sol +326 -0
- package/test/audit/CodexCrossChainBuybackRouteMismatch.t.sol +184 -0
- package/test/audit/NemesisOperatorDelegation.t.sol +77 -10
|
@@ -148,32 +148,82 @@ contract NemesisOperatorDelegationTest is TestBaseWorkflow {
|
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
function
|
|
151
|
+
function test_hiddenTokensOperatorCanAllowHolderToHideOwnTokens() public {
|
|
152
152
|
uint256 userTokens = _payUserIntoRevnet(10e18);
|
|
153
153
|
uint256 hiddenCount = userTokens / 2;
|
|
154
154
|
|
|
155
155
|
_grantPermission(USER, REVNET_ID, address(HIDDEN_TOKENS), JBPermissionIds.BURN_TOKENS);
|
|
156
|
-
|
|
156
|
+
_allowHolderToHide(USER);
|
|
157
157
|
|
|
158
158
|
vm.prank(USER);
|
|
159
159
|
HIDDEN_TOKENS.hideTokensOf(REVNET_ID, hiddenCount, USER);
|
|
160
160
|
|
|
161
|
-
vm.prank(
|
|
162
|
-
HIDDEN_TOKENS.revealTokensOf(REVNET_ID, hiddenCount,
|
|
161
|
+
vm.prank(USER);
|
|
162
|
+
HIDDEN_TOKENS.revealTokensOf(REVNET_ID, hiddenCount, USER);
|
|
163
163
|
|
|
164
164
|
assertEq(HIDDEN_TOKENS.hiddenBalanceOf(USER, REVNET_ID), 0, "holder hidden balance was consumed");
|
|
165
165
|
assertEq(
|
|
166
|
-
jbController().TOKENS().totalBalanceOf(
|
|
167
|
-
|
|
168
|
-
"
|
|
166
|
+
jbController().TOKENS().totalBalanceOf(USER, REVNET_ID),
|
|
167
|
+
userTokens,
|
|
168
|
+
"holder gets their own revealed tokens back"
|
|
169
169
|
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function test_hiddenTokensPermissionedOperatorCanHideOwnTokens() public {
|
|
173
|
+
vm.deal(OPERATOR, 10e18);
|
|
174
|
+
vm.prank(OPERATOR);
|
|
175
|
+
uint256 operatorTokens = jbMultiTerminal().pay{value: 10e18}({
|
|
176
|
+
projectId: REVNET_ID,
|
|
177
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
178
|
+
amount: 10e18,
|
|
179
|
+
beneficiary: OPERATOR,
|
|
180
|
+
minReturnedTokens: 0,
|
|
181
|
+
memo: "",
|
|
182
|
+
metadata: ""
|
|
183
|
+
});
|
|
184
|
+
uint256 hiddenCount = operatorTokens / 2;
|
|
185
|
+
|
|
186
|
+
_grantPermission(OPERATOR, REVNET_ID, address(HIDDEN_TOKENS), JBPermissionIds.BURN_TOKENS);
|
|
187
|
+
_grantOperatorHidePermission(OPERATOR);
|
|
188
|
+
|
|
189
|
+
vm.prank(OPERATOR);
|
|
190
|
+
HIDDEN_TOKENS.hideTokensOf(REVNET_ID, hiddenCount, OPERATOR);
|
|
191
|
+
|
|
192
|
+
assertEq(HIDDEN_TOKENS.hiddenBalanceOf(OPERATOR, REVNET_ID), hiddenCount, "operator hidden balance was updated");
|
|
170
193
|
assertEq(
|
|
171
|
-
jbController().TOKENS().totalBalanceOf(
|
|
172
|
-
|
|
173
|
-
"
|
|
194
|
+
jbController().TOKENS().totalBalanceOf(OPERATOR, REVNET_ID),
|
|
195
|
+
operatorTokens - hiddenCount,
|
|
196
|
+
"operator's visible balance was reduced"
|
|
174
197
|
);
|
|
175
198
|
}
|
|
176
199
|
|
|
200
|
+
function test_hiddenTokensDelegateCannotHideAnotherHoldersTokens() public {
|
|
201
|
+
uint256 userTokens = _payUserIntoRevnet(10e18);
|
|
202
|
+
|
|
203
|
+
_grantPermission(USER, REVNET_ID, address(HIDDEN_TOKENS), JBPermissionIds.BURN_TOKENS);
|
|
204
|
+
_allowHolderToHide(USER);
|
|
205
|
+
|
|
206
|
+
vm.prank(OPERATOR);
|
|
207
|
+
vm.expectRevert(
|
|
208
|
+
abi.encodeWithSelector(REVHiddenTokens.REVHiddenTokens_Unauthorized.selector, REVNET_ID, OPERATOR)
|
|
209
|
+
);
|
|
210
|
+
HIDDEN_TOKENS.hideTokensOf(REVNET_ID, userTokens / 2, USER);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function test_hiddenTokensOperatorCanDisallowHolder() public {
|
|
214
|
+
uint256 userTokens = _payUserIntoRevnet(10e18);
|
|
215
|
+
|
|
216
|
+
_grantPermission(USER, REVNET_ID, address(HIDDEN_TOKENS), JBPermissionIds.BURN_TOKENS);
|
|
217
|
+
_allowHolderToHide(USER);
|
|
218
|
+
|
|
219
|
+
vm.prank(address(REV_DEPLOYER));
|
|
220
|
+
HIDDEN_TOKENS.setTokenHidingAllowedFor(REVNET_ID, USER, false);
|
|
221
|
+
|
|
222
|
+
vm.prank(USER);
|
|
223
|
+
vm.expectRevert(abi.encodeWithSelector(REVHiddenTokens.REVHiddenTokens_Unauthorized.selector, REVNET_ID, USER));
|
|
224
|
+
HIDDEN_TOKENS.hideTokensOf(REVNET_ID, userTokens / 2, USER);
|
|
225
|
+
}
|
|
226
|
+
|
|
177
227
|
function _grantPermission(address account, uint256 revnetId, address operator, uint8 permissionId) internal {
|
|
178
228
|
uint8[] memory permissionIds = new uint8[](1);
|
|
179
229
|
permissionIds[0] = permissionId;
|
|
@@ -200,6 +250,23 @@ contract NemesisOperatorDelegationTest is TestBaseWorkflow {
|
|
|
200
250
|
assertGt(tokenCount, 0, "payment should mint revnet tokens");
|
|
201
251
|
}
|
|
202
252
|
|
|
253
|
+
function _allowHolderToHide(address holder) internal {
|
|
254
|
+
vm.prank(address(REV_DEPLOYER));
|
|
255
|
+
HIDDEN_TOKENS.setTokenHidingAllowedFor(REVNET_ID, holder, true);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function _grantOperatorHidePermission(address operator) internal {
|
|
259
|
+
uint8[] memory permissionIds = new uint8[](1);
|
|
260
|
+
permissionIds[0] = JBPermissionIds.HIDE_TOKENS;
|
|
261
|
+
|
|
262
|
+
vm.prank(address(REV_DEPLOYER));
|
|
263
|
+
jbPermissions()
|
|
264
|
+
.setPermissionsFor(
|
|
265
|
+
address(REV_DEPLOYER),
|
|
266
|
+
JBPermissionsData({operator: operator, projectId: uint56(REVNET_ID), permissionIds: permissionIds})
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
203
270
|
function _deployFeeProject() internal {
|
|
204
271
|
JBAccountingContext[] memory acc = new JBAccountingContext[](1);
|
|
205
272
|
acc[0] = JBAccountingContext({
|