@rev-net/core-v6 0.0.37 → 0.0.39
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/CHANGELOG.md +2 -2
- package/README.md +6 -7
- package/foundry.toml +1 -1
- package/package.json +23 -16
- package/references/operations.md +1 -1
- package/references/runtime.md +1 -1
- package/script/Deploy.s.sol +12 -9
- package/src/REVDeployer.sol +60 -65
- package/src/REVHiddenTokens.sol +2 -2
- package/src/REVLoans.sol +17 -10
- package/src/REVOwner.sol +121 -14
- package/src/interfaces/IREVDeployer.sol +2 -1
- package/src/interfaces/IREVHiddenTokens.sol +4 -1
- package/src/interfaces/IREVOwner.sol +5 -0
- package/ADMINISTRATION.md +0 -73
- package/ARCHITECTURE.md +0 -116
- package/AUDIT_INSTRUCTIONS.md +0 -90
- package/RISKS.md +0 -107
- package/SKILLS.md +0 -46
- package/STYLE_GUIDE.md +0 -610
- package/USER_JOURNEYS.md +0 -195
- package/foundry.lock +0 -11
- package/slither-ci.config.json +0 -10
- package/sphinx.lock +0 -507
- package/test/REV.integrations.t.sol +0 -573
- package/test/REVAutoIssuanceFuzz.t.sol +0 -328
- package/test/REVDeployerRegressions.t.sol +0 -396
- package/test/REVInvincibility.t.sol +0 -1371
- package/test/REVInvincibilityHandler.sol +0 -387
- package/test/REVLifecycle.t.sol +0 -420
- package/test/REVLoans.invariants.t.sol +0 -724
- package/test/REVLoansAttacks.t.sol +0 -816
- package/test/REVLoansFeeRecovery.t.sol +0 -783
- package/test/REVLoansFindings.t.sol +0 -711
- package/test/REVLoansRegressions.t.sol +0 -364
- package/test/REVLoansSourceFeeRecovery.t.sol +0 -517
- package/test/REVLoansSourced.t.sol +0 -1839
- package/test/REVLoansUnSourced.t.sol +0 -409
- package/test/TestAuditFixVerification.t.sol +0 -675
- package/test/TestBurnHeldTokens.t.sol +0 -394
- package/test/TestCEIPattern.t.sol +0 -508
- package/test/TestCashOutCallerValidation.t.sol +0 -452
- package/test/TestConversionDocumentation.t.sol +0 -365
- package/test/TestCrossCurrencyReclaim.t.sol +0 -610
- package/test/TestCrossSourceReallocation.t.sol +0 -361
- package/test/TestERC2771MetaTx.t.sol +0 -585
- package/test/TestEmptyBuybackSpecs.t.sol +0 -300
- package/test/TestFlashLoanSurplus.t.sol +0 -365
- package/test/TestHiddenTokens.t.sol +0 -474
- package/test/TestHookArrayOOB.t.sol +0 -278
- package/test/TestLiquidationBehavior.t.sol +0 -398
- package/test/TestLoanSourceRotation.t.sol +0 -553
- package/test/TestLoansCashOutDelay.t.sol +0 -493
- package/test/TestLongTailEconomics.t.sol +0 -677
- package/test/TestLowFindings.t.sol +0 -677
- package/test/TestMixedFixes.t.sol +0 -593
- package/test/TestPermit2Signatures.t.sol +0 -683
- package/test/TestReallocationSandwich.t.sol +0 -412
- package/test/TestRevnetRegressions.t.sol +0 -350
- package/test/TestSplitWeightAdjustment.t.sol +0 -527
- package/test/TestSplitWeightE2E.t.sol +0 -605
- package/test/TestSplitWeightFork.t.sol +0 -855
- package/test/TestStageTransitionBorrowable.t.sol +0 -301
- package/test/TestSwapTerminalPermission.t.sol +0 -262
- package/test/TestTerminalEncodingInHash.t.sol +0 -326
- package/test/TestUint112Overflow.t.sol +0 -311
- package/test/TestZeroAmountLoanGuard.t.sol +0 -378
- package/test/TestZeroRepayment.t.sol +0 -354
- package/test/audit/CrossChainBuybackRouteMismatch.t.sol +0 -184
- package/test/audit/HiddenSupplyCashout.t.sol +0 -61
- package/test/audit/LoanIdOverflowGuard.t.sol +0 -523
- package/test/audit/NemesisVerification.t.sol +0 -97
- package/test/audit/OperatorDelegation.t.sol +0 -356
- package/test/audit/PhantomSurplusTerminal.t.sol +0 -367
- package/test/audit/REVOwnerCurrencyMismatch.t.sol +0 -188
- package/test/audit/REVOwnerRemoteSurplusCurrencyMismatch.t.sol +0 -140
- package/test/audit/ReallocatePermission.t.sol +0 -363
- package/test/audit/RemoteLoanAccountingGap.t.sol +0 -74
- package/test/audit/SupportsInterfaceTest.t.sol +0 -51
- package/test/audit/TestFeeAllowanceLeak.t.sol +0 -197
- package/test/audit/TestLoansAndDeployerFixes.t.sol +0 -576
- package/test/fork/ForkTestBase.sol +0 -727
- package/test/fork/TestAutoIssuanceFork.t.sol +0 -148
- package/test/fork/TestCashOutFork.t.sol +0 -253
- package/test/fork/TestIssuanceDecayFork.t.sol +0 -158
- package/test/fork/TestLoanAdversarialFork.t.sol +0 -744
- package/test/fork/TestLoanBorrowFork.t.sol +0 -163
- package/test/fork/TestLoanCrossRulesetFork.t.sol +0 -308
- package/test/fork/TestLoanERC20Fork.t.sol +0 -459
- package/test/fork/TestLoanLiquidationFork.t.sol +0 -135
- package/test/fork/TestLoanReallocateFork.t.sol +0 -113
- package/test/fork/TestLoanRepayFork.t.sol +0 -188
- package/test/fork/TestLoanTransferFork.t.sol +0 -143
- package/test/fork/TestPermit2PaymentFork.t.sol +0 -300
- package/test/fork/TestSplitWeightFork.t.sol +0 -189
- package/test/helpers/MaliciousContracts.sol +0 -247
- package/test/helpers/REVEmpty721Config.sol +0 -45
- package/test/mock/MockBuybackCashOutRecorder.sol +0 -84
- package/test/mock/MockBuybackDataHook.sol +0 -112
- package/test/mock/MockBuybackDataHookMintPath.sol +0 -68
- package/test/mock/MockSuckerRegistry.sol +0 -17
- package/test/regression/TestBurnPermissionRequired.t.sol +0 -294
- package/test/regression/TestCashOutBuybackFeeLeak.t.sol +0 -232
- package/test/regression/TestCrossRevnetLiquidation.t.sol +0 -255
- package/test/regression/TestCumulativeLoanCounter.t.sol +0 -361
- package/test/regression/TestLiquidateGapHandling.t.sol +0 -394
- package/test/regression/TestZeroPriceFeed.t.sol +0 -422
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity 0.8.28;
|
|
3
|
-
|
|
4
|
-
import "forge-std/Test.sol";
|
|
5
|
-
import "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
|
|
6
|
-
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
7
|
-
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
8
|
-
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
9
|
-
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
10
|
-
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
11
|
-
import "@croptop/core-v6/src/CTPublisher.sol";
|
|
12
|
-
import "@bananapus/suckers-v6/src/JBSuckerRegistry.sol";
|
|
13
|
-
import "@bananapus/721-hook-v6/src/JB721TiersHook.sol";
|
|
14
|
-
import "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
15
|
-
import "@bananapus/721-hook-v6/src/JB721TiersHookStore.sol";
|
|
16
|
-
import "@bananapus/721-hook-v6/src/JB721CheckpointsDeployer.sol";
|
|
17
|
-
import {IJB721CheckpointsDeployer} from "@bananapus/721-hook-v6/src/interfaces/IJB721CheckpointsDeployer.sol";
|
|
18
|
-
import "@bananapus/address-registry-v6/src/JBAddressRegistry.sol";
|
|
19
|
-
import "@bananapus/address-registry-v6/src/interfaces/IJBAddressRegistry.sol";
|
|
20
|
-
import "@bananapus/buyback-hook-v6/src/interfaces/IJBBuybackHookRegistry.sol";
|
|
21
|
-
import "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
22
|
-
import "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
23
|
-
import "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
24
|
-
import "@bananapus/core-v6/src/structs/JBPermissionsData.sol";
|
|
25
|
-
import "@bananapus/core-v6/src/structs/JBTerminalConfig.sol";
|
|
26
|
-
import "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
27
|
-
import "@bananapus/suckers-v6/src/structs/JBSuckerDeployerConfig.sol";
|
|
28
|
-
|
|
29
|
-
import {MockBuybackDataHook} from "../mock/MockBuybackDataHook.sol";
|
|
30
|
-
import {REVEmpty721Config} from "../helpers/REVEmpty721Config.sol";
|
|
31
|
-
import {REVDeployer} from "../../src/REVDeployer.sol";
|
|
32
|
-
import {REVHiddenTokens} from "../../src/REVHiddenTokens.sol";
|
|
33
|
-
import {REVLoans} from "../../src/REVLoans.sol";
|
|
34
|
-
import {REVOwner} from "../../src/REVOwner.sol";
|
|
35
|
-
import {IREVLoans} from "../../src/interfaces/IREVLoans.sol";
|
|
36
|
-
import {IREVHiddenTokens} from "../../src/interfaces/IREVHiddenTokens.sol";
|
|
37
|
-
import {REVConfig} from "../../src/structs/REVConfig.sol";
|
|
38
|
-
import {REVDescription} from "../../src/structs/REVDescription.sol";
|
|
39
|
-
import {REVLoanSource} from "../../src/structs/REVLoanSource.sol";
|
|
40
|
-
import {REVStageConfig} from "../../src/structs/REVStageConfig.sol";
|
|
41
|
-
import {REVAutoIssuance} from "../../src/structs/REVAutoIssuance.sol";
|
|
42
|
-
import {REVSuckerDeploymentConfig} from "../../src/structs/REVSuckerDeploymentConfig.sol";
|
|
43
|
-
import {IREVDeployer} from "../../src/interfaces/IREVDeployer.sol";
|
|
44
|
-
import {MockSuckerRegistry} from "../mock/MockSuckerRegistry.sol";
|
|
45
|
-
|
|
46
|
-
contract NemesisOperatorDelegationTest is TestBaseWorkflow {
|
|
47
|
-
bytes32 internal constant REV_DEPLOYER_SALT = "REVDeployer";
|
|
48
|
-
bytes32 internal constant ERC20_SALT = "REV_TOKEN";
|
|
49
|
-
|
|
50
|
-
address internal constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
51
|
-
|
|
52
|
-
address internal USER = makeAddr("user");
|
|
53
|
-
address internal OPERATOR = makeAddr("operator");
|
|
54
|
-
|
|
55
|
-
REVDeployer internal REV_DEPLOYER;
|
|
56
|
-
REVOwner internal REV_OWNER;
|
|
57
|
-
REVHiddenTokens internal HIDDEN_TOKENS;
|
|
58
|
-
REVLoans internal LOANS;
|
|
59
|
-
JB721TiersHook internal EXAMPLE_HOOK;
|
|
60
|
-
IJB721TiersHookDeployer internal HOOK_DEPLOYER;
|
|
61
|
-
IJB721TiersHookStore internal HOOK_STORE;
|
|
62
|
-
IJBAddressRegistry internal ADDRESS_REGISTRY;
|
|
63
|
-
IJBSuckerRegistry internal SUCKER_REGISTRY;
|
|
64
|
-
CTPublisher internal PUBLISHER;
|
|
65
|
-
MockBuybackDataHook internal MOCK_BUYBACK;
|
|
66
|
-
|
|
67
|
-
uint256 internal FEE_PROJECT_ID;
|
|
68
|
-
uint256 internal REVNET_ID;
|
|
69
|
-
|
|
70
|
-
function setUp() public override {
|
|
71
|
-
super.setUp();
|
|
72
|
-
|
|
73
|
-
FEE_PROJECT_ID = jbProjects().createFor(multisig());
|
|
74
|
-
SUCKER_REGISTRY = new JBSuckerRegistry(jbDirectory(), jbPermissions(), multisig(), address(0));
|
|
75
|
-
HOOK_STORE = new JB721TiersHookStore();
|
|
76
|
-
EXAMPLE_HOOK = new JB721TiersHook(
|
|
77
|
-
jbDirectory(),
|
|
78
|
-
jbPermissions(),
|
|
79
|
-
jbPrices(),
|
|
80
|
-
jbRulesets(),
|
|
81
|
-
HOOK_STORE,
|
|
82
|
-
jbSplits(),
|
|
83
|
-
IJB721CheckpointsDeployer(address(new JB721CheckpointsDeployer())),
|
|
84
|
-
multisig()
|
|
85
|
-
);
|
|
86
|
-
ADDRESS_REGISTRY = new JBAddressRegistry();
|
|
87
|
-
HOOK_DEPLOYER = new JB721TiersHookDeployer(EXAMPLE_HOOK, HOOK_STORE, ADDRESS_REGISTRY, multisig());
|
|
88
|
-
PUBLISHER = new CTPublisher(jbDirectory(), jbPermissions(), FEE_PROJECT_ID, multisig());
|
|
89
|
-
MOCK_BUYBACK = new MockBuybackDataHook();
|
|
90
|
-
|
|
91
|
-
LOANS = new REVLoans({
|
|
92
|
-
controller: jbController(),
|
|
93
|
-
suckerRegistry: IJBSuckerRegistry(address(new MockSuckerRegistry())),
|
|
94
|
-
revId: FEE_PROJECT_ID,
|
|
95
|
-
owner: address(this),
|
|
96
|
-
permit2: permit2(),
|
|
97
|
-
trustedForwarder: TRUSTED_FORWARDER
|
|
98
|
-
});
|
|
99
|
-
HIDDEN_TOKENS = new REVHiddenTokens(jbController(), TRUSTED_FORWARDER);
|
|
100
|
-
REV_OWNER = new REVOwner(
|
|
101
|
-
IJBBuybackHookRegistry(address(MOCK_BUYBACK)),
|
|
102
|
-
jbDirectory(),
|
|
103
|
-
FEE_PROJECT_ID,
|
|
104
|
-
SUCKER_REGISTRY,
|
|
105
|
-
address(LOANS),
|
|
106
|
-
address(HIDDEN_TOKENS)
|
|
107
|
-
);
|
|
108
|
-
REV_DEPLOYER = new REVDeployer{salt: REV_DEPLOYER_SALT}(
|
|
109
|
-
jbController(),
|
|
110
|
-
SUCKER_REGISTRY,
|
|
111
|
-
FEE_PROJECT_ID,
|
|
112
|
-
HOOK_DEPLOYER,
|
|
113
|
-
PUBLISHER,
|
|
114
|
-
IJBBuybackHookRegistry(address(MOCK_BUYBACK)),
|
|
115
|
-
address(LOANS),
|
|
116
|
-
TRUSTED_FORWARDER,
|
|
117
|
-
address(REV_OWNER)
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
REV_OWNER.setDeployer(IREVDeployer(REV_DEPLOYER));
|
|
121
|
-
|
|
122
|
-
vm.prank(multisig());
|
|
123
|
-
jbProjects().approve(address(REV_DEPLOYER), FEE_PROJECT_ID);
|
|
124
|
-
|
|
125
|
-
_deployFeeProject();
|
|
126
|
-
REVNET_ID = _deployRevnet();
|
|
127
|
-
|
|
128
|
-
vm.deal(USER, 100e18);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function test_openLoanOperatorCanRedirectBorrowedFunds() public {
|
|
132
|
-
uint256 userTokens = _payUserIntoRevnet(10e18);
|
|
133
|
-
_grantPermission(USER, REVNET_ID, address(LOANS), JBPermissionIds.BURN_TOKENS);
|
|
134
|
-
_grantPermission(USER, REVNET_ID, OPERATOR, JBPermissionIds.OPEN_LOAN);
|
|
135
|
-
|
|
136
|
-
REVLoanSource memory source = REVLoanSource({token: JBConstants.NATIVE_TOKEN, terminal: jbMultiTerminal()});
|
|
137
|
-
uint256 operatorBalanceBefore = OPERATOR.balance;
|
|
138
|
-
|
|
139
|
-
vm.prank(OPERATOR);
|
|
140
|
-
(uint256 loanId,) = LOANS.borrowFrom(REVNET_ID, source, 0, userTokens / 2, payable(OPERATOR), 25, USER);
|
|
141
|
-
|
|
142
|
-
assertEq(LOANS.ownerOf(loanId), USER, "loan NFT stays with the holder");
|
|
143
|
-
assertGt(OPERATOR.balance, operatorBalanceBefore, "operator receives the borrowed funds");
|
|
144
|
-
assertLt(
|
|
145
|
-
jbController().TOKENS().totalBalanceOf(USER, REVNET_ID),
|
|
146
|
-
userTokens,
|
|
147
|
-
"holder lost collateral even though proceeds were redirected"
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function test_hiddenTokensOperatorCanAllowHolderToHideOwnTokens() public {
|
|
152
|
-
uint256 userTokens = _payUserIntoRevnet(10e18);
|
|
153
|
-
uint256 hiddenCount = userTokens / 2;
|
|
154
|
-
|
|
155
|
-
_grantPermission(USER, REVNET_ID, address(HIDDEN_TOKENS), JBPermissionIds.BURN_TOKENS);
|
|
156
|
-
_allowHolderToHide(USER);
|
|
157
|
-
|
|
158
|
-
vm.prank(USER);
|
|
159
|
-
HIDDEN_TOKENS.hideTokensOf(REVNET_ID, hiddenCount, USER);
|
|
160
|
-
|
|
161
|
-
vm.prank(USER);
|
|
162
|
-
HIDDEN_TOKENS.revealTokensOf(REVNET_ID, hiddenCount, USER);
|
|
163
|
-
|
|
164
|
-
assertEq(HIDDEN_TOKENS.hiddenBalanceOf(USER, REVNET_ID), 0, "holder hidden balance was consumed");
|
|
165
|
-
assertEq(
|
|
166
|
-
jbController().TOKENS().totalBalanceOf(USER, REVNET_ID),
|
|
167
|
-
userTokens,
|
|
168
|
-
"holder gets their own revealed tokens back"
|
|
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");
|
|
193
|
-
assertEq(
|
|
194
|
-
jbController().TOKENS().totalBalanceOf(OPERATOR, REVNET_ID),
|
|
195
|
-
operatorTokens - hiddenCount,
|
|
196
|
-
"operator's visible balance was reduced"
|
|
197
|
-
);
|
|
198
|
-
}
|
|
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
|
-
|
|
227
|
-
function _grantPermission(address account, uint256 revnetId, address operator, uint8 permissionId) internal {
|
|
228
|
-
uint8[] memory permissionIds = new uint8[](1);
|
|
229
|
-
permissionIds[0] = permissionId;
|
|
230
|
-
|
|
231
|
-
vm.prank(account);
|
|
232
|
-
jbPermissions()
|
|
233
|
-
.setPermissionsFor(
|
|
234
|
-
account,
|
|
235
|
-
JBPermissionsData({operator: operator, projectId: uint56(revnetId), permissionIds: permissionIds})
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function _payUserIntoRevnet(uint256 amount) internal returns (uint256 tokenCount) {
|
|
240
|
-
vm.prank(USER);
|
|
241
|
-
tokenCount = jbMultiTerminal().pay{value: amount}({
|
|
242
|
-
projectId: REVNET_ID,
|
|
243
|
-
token: JBConstants.NATIVE_TOKEN,
|
|
244
|
-
amount: amount,
|
|
245
|
-
beneficiary: USER,
|
|
246
|
-
minReturnedTokens: 0,
|
|
247
|
-
memo: "",
|
|
248
|
-
metadata: ""
|
|
249
|
-
});
|
|
250
|
-
assertGt(tokenCount, 0, "payment should mint revnet tokens");
|
|
251
|
-
}
|
|
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
|
-
|
|
270
|
-
function _deployFeeProject() internal {
|
|
271
|
-
JBAccountingContext[] memory acc = new JBAccountingContext[](1);
|
|
272
|
-
acc[0] = JBAccountingContext({
|
|
273
|
-
token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
JBTerminalConfig[] memory tc = new JBTerminalConfig[](1);
|
|
277
|
-
tc[0] = JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: acc});
|
|
278
|
-
|
|
279
|
-
REVStageConfig[] memory stages = new REVStageConfig[](1);
|
|
280
|
-
stages[0] = REVStageConfig({
|
|
281
|
-
startsAtOrAfter: uint40(block.timestamp),
|
|
282
|
-
autoIssuances: new REVAutoIssuance[](0),
|
|
283
|
-
splitPercent: 0,
|
|
284
|
-
splits: new JBSplit[](0),
|
|
285
|
-
initialIssuance: uint112(1000e18),
|
|
286
|
-
issuanceCutFrequency: 0,
|
|
287
|
-
issuanceCutPercent: 0,
|
|
288
|
-
cashOutTaxRate: 0,
|
|
289
|
-
extraMetadata: 0
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
REVConfig memory feeConfig = REVConfig({
|
|
293
|
-
description: REVDescription("Fee Revnet", "FEE", "", ERC20_SALT),
|
|
294
|
-
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
295
|
-
splitOperator: multisig(),
|
|
296
|
-
stageConfigurations: stages
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
vm.prank(multisig());
|
|
300
|
-
REV_DEPLOYER.deployFor({
|
|
301
|
-
revnetId: FEE_PROJECT_ID,
|
|
302
|
-
configuration: feeConfig,
|
|
303
|
-
terminalConfigurations: tc,
|
|
304
|
-
suckerDeploymentConfiguration: REVSuckerDeploymentConfig({
|
|
305
|
-
deployerConfigurations: new JBSuckerDeployerConfig[](0), salt: keccak256("FEE")
|
|
306
|
-
}),
|
|
307
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
308
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function _deployRevnet() internal returns (uint256 revnetId) {
|
|
313
|
-
JBAccountingContext[] memory acc = new JBAccountingContext[](1);
|
|
314
|
-
acc[0] = JBAccountingContext({
|
|
315
|
-
token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
JBTerminalConfig[] memory tc = new JBTerminalConfig[](1);
|
|
319
|
-
tc[0] = JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: acc});
|
|
320
|
-
|
|
321
|
-
REVStageConfig[] memory stages = new REVStageConfig[](1);
|
|
322
|
-
JBSplit[] memory splits = new JBSplit[](1);
|
|
323
|
-
splits[0].beneficiary = payable(multisig());
|
|
324
|
-
splits[0].percent = 10_000;
|
|
325
|
-
|
|
326
|
-
stages[0] = REVStageConfig({
|
|
327
|
-
startsAtOrAfter: uint40(block.timestamp),
|
|
328
|
-
autoIssuances: new REVAutoIssuance[](0),
|
|
329
|
-
splitPercent: 2000,
|
|
330
|
-
splits: splits,
|
|
331
|
-
initialIssuance: uint112(1000e18),
|
|
332
|
-
issuanceCutFrequency: 90 days,
|
|
333
|
-
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
334
|
-
cashOutTaxRate: 6000,
|
|
335
|
-
extraMetadata: 0
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
REVConfig memory config = REVConfig({
|
|
339
|
-
description: REVDescription("Revnet", "REV", "", bytes32("REV_TOKEN_2")),
|
|
340
|
-
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
341
|
-
splitOperator: multisig(),
|
|
342
|
-
stageConfigurations: stages
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
(revnetId,) = REV_DEPLOYER.deployFor({
|
|
346
|
-
revnetId: 0,
|
|
347
|
-
configuration: config,
|
|
348
|
-
terminalConfigurations: tc,
|
|
349
|
-
suckerDeploymentConfiguration: REVSuckerDeploymentConfig({
|
|
350
|
-
deployerConfigurations: new JBSuckerDeployerConfig[](0), salt: keccak256("REV")
|
|
351
|
-
}),
|
|
352
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
353
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
}
|