@rev-net/core-v6 0.0.36 → 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 +134 -90
- package/src/REVOwner.sol +124 -17
- 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 -97
- 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 -368
- 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/CodexCrossChainBuybackRouteMismatch.t.sol +0 -184
- package/test/audit/CodexPhantomSurplusTerminal.t.sol +0 -367
- package/test/audit/CodexREVOwnerRemoteSurplusCurrencyMismatch.t.sol +0 -142
- package/test/audit/LoanIdOverflowGuard.t.sol +0 -523
- package/test/audit/NemesisOperatorDelegation.t.sol +0 -356
- 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/TestLoanBorrowFork.t.sol +0 -163
- package/test/fork/TestLoanCrossRulesetFork.t.sol +0 -308
- package/test/fork/TestLoanERC20Fork.t.sol +0 -465
- 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,350 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity 0.8.28;
|
|
3
|
-
|
|
4
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
5
|
-
import "forge-std/Test.sol";
|
|
6
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
7
|
-
import /* {*} from */ "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
|
|
8
|
-
// import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
9
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
10
|
-
import /* {*} from */ "./../src/REVDeployer.sol";
|
|
11
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
12
|
-
import "@croptop/core-v6/src/CTPublisher.sol";
|
|
13
|
-
import {MockBuybackDataHook} from "./mock/MockBuybackDataHook.sol";
|
|
14
|
-
import {REVEmpty721Config} from "./helpers/REVEmpty721Config.sol";
|
|
15
|
-
|
|
16
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
17
|
-
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
18
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
19
|
-
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
20
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
21
|
-
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
22
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
23
|
-
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
24
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
25
|
-
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
26
|
-
|
|
27
|
-
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
28
|
-
import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
29
|
-
import {JBSingleAllowance} from "@bananapus/core-v6/src/structs/JBSingleAllowance.sol";
|
|
30
|
-
import {REVLoans} from "../src/REVLoans.sol";
|
|
31
|
-
import {REVLoan} from "../src/structs/REVLoan.sol";
|
|
32
|
-
import {REVStageConfig, REVAutoIssuance} from "../src/structs/REVStageConfig.sol";
|
|
33
|
-
import {REVLoanSource} from "../src/structs/REVLoanSource.sol";
|
|
34
|
-
import {REVDescription} from "../src/structs/REVDescription.sol";
|
|
35
|
-
import {IREVLoans} from "./../src/interfaces/IREVLoans.sol";
|
|
36
|
-
import {JBSuckerDeployerConfig} from "@bananapus/suckers-v6/src/structs/JBSuckerDeployerConfig.sol";
|
|
37
|
-
import {JBSuckerRegistry} from "@bananapus/suckers-v6/src/JBSuckerRegistry.sol";
|
|
38
|
-
import {JB721TiersHookDeployer} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
39
|
-
import {JB721TiersHook} from "@bananapus/721-hook-v6/src/JB721TiersHook.sol";
|
|
40
|
-
import {JB721TiersHookStore} from "@bananapus/721-hook-v6/src/JB721TiersHookStore.sol";
|
|
41
|
-
import {JB721CheckpointsDeployer} from "@bananapus/721-hook-v6/src/JB721CheckpointsDeployer.sol";
|
|
42
|
-
import {IJB721CheckpointsDeployer} from "@bananapus/721-hook-v6/src/interfaces/IJB721CheckpointsDeployer.sol";
|
|
43
|
-
import {JBAddressRegistry} from "@bananapus/address-registry-v6/src/JBAddressRegistry.sol";
|
|
44
|
-
import {IJBAddressRegistry} from "@bananapus/address-registry-v6/src/interfaces/IJBAddressRegistry.sol";
|
|
45
|
-
import {REVOwner} from "../src/REVOwner.sol";
|
|
46
|
-
import {IREVDeployer} from "../src/interfaces/IREVDeployer.sol";
|
|
47
|
-
import {MockSuckerRegistry} from "./mock/MockSuckerRegistry.sol";
|
|
48
|
-
|
|
49
|
-
/// @notice A test harness that exposes REVLoans internal functions for direct testing.
|
|
50
|
-
/// Used to test _totalBorrowedFrom without needing to set up a full borrow flow.
|
|
51
|
-
contract REVLoansHarness is REVLoans {
|
|
52
|
-
constructor(
|
|
53
|
-
IJBController controller,
|
|
54
|
-
IJBSuckerRegistry suckerRegistry,
|
|
55
|
-
uint256 revId,
|
|
56
|
-
address owner,
|
|
57
|
-
IPermit2 permit2,
|
|
58
|
-
address trustedForwarder
|
|
59
|
-
)
|
|
60
|
-
REVLoans(controller, suckerRegistry, revId, owner, permit2, trustedForwarder)
|
|
61
|
-
{}
|
|
62
|
-
|
|
63
|
-
/// @notice Expose _totalBorrowedFrom for testing.
|
|
64
|
-
function exposed_totalBorrowedFrom(
|
|
65
|
-
uint256 revnetId,
|
|
66
|
-
uint256 decimals,
|
|
67
|
-
uint256 currency
|
|
68
|
-
)
|
|
69
|
-
external
|
|
70
|
-
view
|
|
71
|
-
returns (uint256)
|
|
72
|
-
{
|
|
73
|
-
return _totalBorrowedFrom(revnetId, decimals, currency);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/// @notice Set totalBorrowedFrom for testing.
|
|
77
|
-
function setTotalBorrowedFrom(
|
|
78
|
-
uint256 revnetId,
|
|
79
|
-
IJBPayoutTerminal terminal,
|
|
80
|
-
address token,
|
|
81
|
-
uint256 amount
|
|
82
|
-
)
|
|
83
|
-
external
|
|
84
|
-
{
|
|
85
|
-
totalBorrowedFrom[revnetId][terminal][token] = amount;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/// @notice Register a loan source for testing.
|
|
89
|
-
function addLoanSource(uint256 revnetId, REVLoanSource memory source) external {
|
|
90
|
-
_loanSourcesOf[revnetId].push(source);
|
|
91
|
-
isLoanSourceOf[revnetId][source.terminal][source.token] = true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/// @notice Regression tests for zero price feed DoS in REVLoans._totalBorrowedFrom.
|
|
96
|
-
contract TestRevnetRegressions is TestBaseWorkflow {
|
|
97
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
98
|
-
bytes32 REV_DEPLOYER_SALT = "REVDeployer";
|
|
99
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
100
|
-
bytes32 ERC20_SALT = "REV_TOKEN";
|
|
101
|
-
|
|
102
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
103
|
-
REVDeployer REV_DEPLOYER;
|
|
104
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
105
|
-
REVOwner REV_OWNER;
|
|
106
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
107
|
-
JB721TiersHook EXAMPLE_HOOK;
|
|
108
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
109
|
-
IJB721TiersHookDeployer HOOK_DEPLOYER;
|
|
110
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
111
|
-
IJB721TiersHookStore HOOK_STORE;
|
|
112
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
113
|
-
IJBAddressRegistry ADDRESS_REGISTRY;
|
|
114
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
115
|
-
REVLoansHarness LOANS_CONTRACT;
|
|
116
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
117
|
-
IJBSuckerRegistry SUCKER_REGISTRY;
|
|
118
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
119
|
-
CTPublisher PUBLISHER;
|
|
120
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
121
|
-
MockBuybackDataHook MOCK_BUYBACK;
|
|
122
|
-
|
|
123
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
124
|
-
uint256 FEE_PROJECT_ID;
|
|
125
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
126
|
-
address USER = makeAddr("user");
|
|
127
|
-
|
|
128
|
-
address private constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
129
|
-
|
|
130
|
-
function setUp() public override {
|
|
131
|
-
super.setUp();
|
|
132
|
-
|
|
133
|
-
FEE_PROJECT_ID = jbProjects().createFor(multisig());
|
|
134
|
-
|
|
135
|
-
SUCKER_REGISTRY = new JBSuckerRegistry(jbDirectory(), jbPermissions(), multisig(), address(0));
|
|
136
|
-
HOOK_STORE = new JB721TiersHookStore();
|
|
137
|
-
EXAMPLE_HOOK = new JB721TiersHook(
|
|
138
|
-
jbDirectory(),
|
|
139
|
-
jbPermissions(),
|
|
140
|
-
jbPrices(),
|
|
141
|
-
jbRulesets(),
|
|
142
|
-
HOOK_STORE,
|
|
143
|
-
jbSplits(),
|
|
144
|
-
IJB721CheckpointsDeployer(address(new JB721CheckpointsDeployer())),
|
|
145
|
-
multisig()
|
|
146
|
-
);
|
|
147
|
-
ADDRESS_REGISTRY = new JBAddressRegistry();
|
|
148
|
-
HOOK_DEPLOYER = new JB721TiersHookDeployer(EXAMPLE_HOOK, HOOK_STORE, ADDRESS_REGISTRY, multisig());
|
|
149
|
-
PUBLISHER = new CTPublisher(jbDirectory(), jbPermissions(), FEE_PROJECT_ID, multisig());
|
|
150
|
-
MOCK_BUYBACK = new MockBuybackDataHook();
|
|
151
|
-
|
|
152
|
-
LOANS_CONTRACT = new REVLoansHarness({
|
|
153
|
-
controller: jbController(),
|
|
154
|
-
suckerRegistry: IJBSuckerRegistry(address(new MockSuckerRegistry())),
|
|
155
|
-
revId: FEE_PROJECT_ID,
|
|
156
|
-
owner: address(this),
|
|
157
|
-
permit2: permit2(),
|
|
158
|
-
trustedForwarder: TRUSTED_FORWARDER
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
REV_OWNER = new REVOwner(
|
|
162
|
-
IJBBuybackHookRegistry(address(MOCK_BUYBACK)),
|
|
163
|
-
jbDirectory(),
|
|
164
|
-
FEE_PROJECT_ID,
|
|
165
|
-
SUCKER_REGISTRY,
|
|
166
|
-
address(LOANS_CONTRACT),
|
|
167
|
-
address(0)
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
REV_DEPLOYER = new REVDeployer{salt: REV_DEPLOYER_SALT}(
|
|
171
|
-
jbController(),
|
|
172
|
-
SUCKER_REGISTRY,
|
|
173
|
-
FEE_PROJECT_ID,
|
|
174
|
-
HOOK_DEPLOYER,
|
|
175
|
-
PUBLISHER,
|
|
176
|
-
IJBBuybackHookRegistry(address(MOCK_BUYBACK)),
|
|
177
|
-
address(LOANS_CONTRACT),
|
|
178
|
-
TRUSTED_FORWARDER,
|
|
179
|
-
address(REV_OWNER)
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
REV_OWNER.setDeployer(REV_DEPLOYER);
|
|
183
|
-
|
|
184
|
-
vm.prank(multisig());
|
|
185
|
-
jbProjects().approve(address(REV_DEPLOYER), FEE_PROJECT_ID);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
//*********************************************************************//
|
|
189
|
-
// ---- Zero price feed return causes DoS in _totalBorrowedFrom ----- //
|
|
190
|
-
//*********************************************************************//
|
|
191
|
-
|
|
192
|
-
/// @notice Demonstrates that `_totalBorrowedFrom` does not revert when
|
|
193
|
-
/// `pricePerUnitOf` returns 0 for a cross-currency loan source.
|
|
194
|
-
/// Before the fix, `mulDiv(x, y, 0)` would panic with a division-by-zero,
|
|
195
|
-
/// blocking all loan operations that aggregate cross-currency borrowed amounts.
|
|
196
|
-
function test_zeroPriceFeedSkippedInTotalBorrowed() public {
|
|
197
|
-
// Deploy the fee revnet (required by the system).
|
|
198
|
-
_deployFeeRevnet();
|
|
199
|
-
|
|
200
|
-
// Deploy a borrowable revnet.
|
|
201
|
-
uint256 revnetId = _deployBorrowableRevnet();
|
|
202
|
-
|
|
203
|
-
// Manually register a loan source with a DIFFERENT currency (fakeCurrency = 999).
|
|
204
|
-
// This simulates having an outstanding loan in a token with a different accounting currency.
|
|
205
|
-
uint32 fakeCurrency = 999;
|
|
206
|
-
address fakeToken = address(0xDEAD);
|
|
207
|
-
|
|
208
|
-
// Create a mock terminal that reports the fake accounting context.
|
|
209
|
-
// We use vm.mockCall to make the terminal report the fake currency.
|
|
210
|
-
address mockTerminal = makeAddr("mockTerminal");
|
|
211
|
-
vm.mockCall(
|
|
212
|
-
mockTerminal,
|
|
213
|
-
abi.encodeWithSelector(IJBTerminal.accountingContextForTokenOf.selector, revnetId, fakeToken),
|
|
214
|
-
abi.encode(JBAccountingContext({token: fakeToken, decimals: 18, currency: fakeCurrency}))
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
// Register the loan source and set a non-zero borrowed amount via the harness.
|
|
218
|
-
LOANS_CONTRACT.addLoanSource(
|
|
219
|
-
revnetId, REVLoanSource({token: fakeToken, terminal: IJBPayoutTerminal(mockTerminal)})
|
|
220
|
-
);
|
|
221
|
-
LOANS_CONTRACT.setTotalBorrowedFrom(revnetId, IJBPayoutTerminal(mockTerminal), fakeToken, 1e18);
|
|
222
|
-
|
|
223
|
-
// Mock PRICES.pricePerUnitOf to return 0 for the cross-currency conversion.
|
|
224
|
-
// This simulates a broken, stale, or uninitialized price feed.
|
|
225
|
-
vm.mockCall(
|
|
226
|
-
address(jbPrices()),
|
|
227
|
-
abi.encodeWithSelector(
|
|
228
|
-
IJBPrices.pricePerUnitOf.selector,
|
|
229
|
-
revnetId,
|
|
230
|
-
uint256(fakeCurrency),
|
|
231
|
-
uint256(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
232
|
-
uint256(18)
|
|
233
|
-
),
|
|
234
|
-
abi.encode(uint256(0))
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
// Call _totalBorrowedFrom via the harness.
|
|
238
|
-
// Before the fix: this would panic with division-by-zero in mulDiv.
|
|
239
|
-
// After the fix: the zero-price source is skipped with `continue`.
|
|
240
|
-
uint256 totalBorrowed =
|
|
241
|
-
LOANS_CONTRACT.exposed_totalBorrowedFrom(revnetId, 18, uint32(uint160(JBConstants.NATIVE_TOKEN)));
|
|
242
|
-
|
|
243
|
-
// The source with zero price should be skipped, so the total is 0
|
|
244
|
-
// (the fake source is not counted because its price feed returned 0).
|
|
245
|
-
assertEq(totalBorrowed, 0, "_totalBorrowedFrom should return 0 when price feed returns 0, not panic");
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
//*********************************************************************//
|
|
249
|
-
// ---- Helpers ------------------------------------------------------ //
|
|
250
|
-
//*********************************************************************//
|
|
251
|
-
|
|
252
|
-
function _deployFeeRevnet() internal {
|
|
253
|
-
JBAccountingContext[] memory accountingContextsToAccept = new JBAccountingContext[](1);
|
|
254
|
-
accountingContextsToAccept[0] = JBAccountingContext({
|
|
255
|
-
token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
JBTerminalConfig[] memory terminalConfigurations = new JBTerminalConfig[](1);
|
|
259
|
-
terminalConfigurations[0] =
|
|
260
|
-
JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: accountingContextsToAccept});
|
|
261
|
-
|
|
262
|
-
REVStageConfig[] memory stageConfigurations = new REVStageConfig[](1);
|
|
263
|
-
JBSplit[] memory splits = new JBSplit[](1);
|
|
264
|
-
splits[0].beneficiary = payable(multisig());
|
|
265
|
-
splits[0].percent = 10_000;
|
|
266
|
-
|
|
267
|
-
REVAutoIssuance[] memory issuanceConfs = new REVAutoIssuance[](1);
|
|
268
|
-
issuanceConfs[0] =
|
|
269
|
-
REVAutoIssuance({chainId: uint32(block.chainid), count: uint104(70_000e18), beneficiary: multisig()});
|
|
270
|
-
|
|
271
|
-
stageConfigurations[0] = REVStageConfig({
|
|
272
|
-
startsAtOrAfter: uint40(block.timestamp),
|
|
273
|
-
autoIssuances: issuanceConfs,
|
|
274
|
-
splitPercent: 2000,
|
|
275
|
-
splits: splits,
|
|
276
|
-
initialIssuance: uint112(1000e18),
|
|
277
|
-
issuanceCutFrequency: 90 days,
|
|
278
|
-
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
279
|
-
cashOutTaxRate: 6000,
|
|
280
|
-
extraMetadata: 0
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
REVConfig memory revnetConfiguration = REVConfig({
|
|
284
|
-
// forge-lint: disable-next-line(named-struct-fields)
|
|
285
|
-
description: REVDescription("Revnet", "$REV", "ipfs://test", ERC20_SALT),
|
|
286
|
-
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
287
|
-
splitOperator: multisig(),
|
|
288
|
-
stageConfigurations: stageConfigurations
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
vm.prank(multisig());
|
|
292
|
-
REV_DEPLOYER.deployFor({
|
|
293
|
-
revnetId: FEE_PROJECT_ID,
|
|
294
|
-
configuration: revnetConfiguration,
|
|
295
|
-
terminalConfigurations: terminalConfigurations,
|
|
296
|
-
suckerDeploymentConfiguration: REVSuckerDeploymentConfig({
|
|
297
|
-
deployerConfigurations: new JBSuckerDeployerConfig[](0), salt: keccak256(abi.encodePacked("REV"))
|
|
298
|
-
}),
|
|
299
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
300
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function _deployBorrowableRevnet() internal returns (uint256 revnetId) {
|
|
305
|
-
JBAccountingContext[] memory accountingContextsToAccept = new JBAccountingContext[](1);
|
|
306
|
-
accountingContextsToAccept[0] = JBAccountingContext({
|
|
307
|
-
token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
JBTerminalConfig[] memory terminalConfigurations = new JBTerminalConfig[](1);
|
|
311
|
-
terminalConfigurations[0] =
|
|
312
|
-
JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: accountingContextsToAccept});
|
|
313
|
-
|
|
314
|
-
REVStageConfig[] memory stageConfigurations = new REVStageConfig[](1);
|
|
315
|
-
JBSplit[] memory splits = new JBSplit[](1);
|
|
316
|
-
splits[0].beneficiary = payable(multisig());
|
|
317
|
-
splits[0].percent = 10_000;
|
|
318
|
-
|
|
319
|
-
stageConfigurations[0] = REVStageConfig({
|
|
320
|
-
startsAtOrAfter: uint40(block.timestamp),
|
|
321
|
-
autoIssuances: new REVAutoIssuance[](0),
|
|
322
|
-
splitPercent: 0,
|
|
323
|
-
splits: splits,
|
|
324
|
-
initialIssuance: uint112(1000e18),
|
|
325
|
-
issuanceCutFrequency: 0,
|
|
326
|
-
issuanceCutPercent: 0,
|
|
327
|
-
cashOutTaxRate: 5000,
|
|
328
|
-
extraMetadata: 0
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
REVConfig memory revnetConfiguration = REVConfig({
|
|
332
|
-
// forge-lint: disable-next-line(named-struct-fields)
|
|
333
|
-
description: REVDescription("Borrowable", "BRW", "ipfs://brw", "BRW_TOKEN"),
|
|
334
|
-
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
335
|
-
splitOperator: multisig(),
|
|
336
|
-
stageConfigurations: stageConfigurations
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
(revnetId,) = REV_DEPLOYER.deployFor({
|
|
340
|
-
revnetId: 0,
|
|
341
|
-
configuration: revnetConfiguration,
|
|
342
|
-
terminalConfigurations: terminalConfigurations,
|
|
343
|
-
suckerDeploymentConfiguration: REVSuckerDeploymentConfig({
|
|
344
|
-
deployerConfigurations: new JBSuckerDeployerConfig[](0), salt: keccak256(abi.encodePacked("BRW"))
|
|
345
|
-
}),
|
|
346
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
347
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}
|