@rev-net/core-v6 0.0.11 → 0.0.13
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 +7 -7
- package/ARCHITECTURE.md +11 -11
- package/AUDIT_INSTRUCTIONS.md +295 -0
- package/CHANGE_LOG.md +316 -0
- package/README.md +9 -6
- package/RISKS.md +180 -35
- package/SKILLS.md +9 -11
- package/STYLE_GUIDE.md +14 -1
- package/USER_JOURNEYS.md +489 -0
- package/package.json +9 -9
- package/script/Deploy.s.sol +124 -40
- package/script/helpers/RevnetCoreDeploymentLib.sol +19 -6
- package/src/REVDeployer.sol +183 -175
- package/src/REVLoans.sol +65 -28
- package/src/interfaces/IREVDeployer.sol +25 -23
- package/src/structs/REV721TiersHookFlags.sol +1 -0
- package/src/structs/REVAutoIssuance.sol +1 -0
- package/src/structs/REVBaseline721HookConfig.sol +1 -0
- package/src/structs/REVConfig.sol +1 -0
- package/src/structs/REVCroptopAllowedPost.sol +1 -0
- package/src/structs/REVDeploy721TiersHookConfig.sol +13 -14
- package/src/structs/REVDescription.sol +1 -0
- package/src/structs/REVLoan.sol +1 -0
- package/src/structs/REVLoanSource.sol +1 -0
- package/src/structs/REVStageConfig.sol +1 -0
- package/src/structs/REVSuckerDeploymentConfig.sol +1 -0
- package/test/REV.integrations.t.sol +148 -19
- package/test/REVAutoIssuanceFuzz.t.sol +31 -6
- package/test/REVDeployerRegressions.t.sol +47 -9
- package/test/REVInvincibility.t.sol +83 -19
- package/test/REVInvincibilityHandler.sol +29 -0
- package/test/REVLifecycle.t.sol +36 -6
- package/test/REVLoans.invariants.t.sol +64 -10
- package/test/REVLoansAttacks.t.sol +54 -9
- package/test/REVLoansFeeRecovery.t.sol +61 -15
- package/test/REVLoansFindings.t.sol +42 -9
- package/test/REVLoansRegressions.t.sol +33 -6
- package/test/REVLoansSourceFeeRecovery.t.sol +491 -0
- package/test/REVLoansSourced.t.sol +79 -17
- package/test/REVLoansUnSourced.t.sol +61 -10
- package/test/TestBurnHeldTokens.t.sol +47 -11
- package/test/TestCEIPattern.t.sol +37 -6
- package/test/TestCashOutCallerValidation.t.sol +41 -8
- package/test/TestConversionDocumentation.t.sol +50 -13
- package/test/TestCrossCurrencyReclaim.t.sol +584 -0
- package/test/TestCrossSourceReallocation.t.sol +37 -6
- package/test/TestERC2771MetaTx.t.sol +557 -0
- package/test/TestEmptyBuybackSpecs.t.sol +45 -10
- package/test/TestFlashLoanSurplus.t.sol +39 -7
- package/test/TestHookArrayOOB.t.sol +42 -13
- package/test/TestLiquidationBehavior.t.sol +37 -7
- package/test/TestLoanSourceRotation.t.sol +525 -0
- package/test/TestLongTailEconomics.t.sol +651 -0
- package/test/TestLowFindings.t.sol +80 -8
- package/test/TestMixedFixes.t.sol +43 -9
- package/test/TestPermit2Signatures.t.sol +657 -0
- package/test/TestReallocationSandwich.t.sol +384 -0
- package/test/TestRevnetRegressions.t.sol +324 -0
- package/test/TestSplitWeightAdjustment.t.sol +52 -13
- package/test/TestSplitWeightE2E.t.sol +53 -18
- package/test/TestSplitWeightFork.t.sol +66 -21
- package/test/TestStageTransitionBorrowable.t.sol +38 -6
- package/test/TestSwapTerminalPermission.t.sol +37 -7
- package/test/TestUint112Overflow.t.sol +39 -6
- package/test/TestZeroRepayment.t.sol +37 -6
- package/test/fork/ForkTestBase.sol +66 -17
- package/test/fork/TestCashOutFork.t.sol +9 -3
- package/test/fork/TestLoanBorrowFork.t.sol +1 -0
- package/test/fork/TestLoanCrossRulesetFork.t.sol +11 -3
- package/test/fork/TestLoanLiquidationFork.t.sol +1 -0
- package/test/fork/TestLoanReallocateFork.t.sol +1 -0
- package/test/fork/TestLoanRepayFork.t.sol +1 -0
- package/test/fork/TestLoanTransferFork.t.sol +133 -0
- package/test/fork/TestSplitWeightFork.t.sol +3 -0
- package/test/helpers/REVEmpty721Config.sol +46 -0
- package/test/mock/MockBuybackDataHook.sol +1 -0
- package/test/regression/TestBurnPermissionRequired.t.sol +267 -0
- package/test/regression/TestCrossRevnetLiquidation.t.sol +228 -0
- package/test/regression/TestCumulativeLoanCounter.t.sol +38 -8
- package/test/regression/TestLiquidateGapHandling.t.sol +40 -8
- package/test/regression/TestZeroPriceFeed.t.sol +396 -0
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
4
5
|
import "forge-std/Test.sol";
|
|
6
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
5
7
|
import /* {*} from */ "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
|
|
6
|
-
import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
8
|
+
// import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
9
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
7
10
|
import /* {*} from */ "./../src/REVDeployer.sol";
|
|
11
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
8
12
|
import "@croptop/core-v6/src/CTPublisher.sol";
|
|
9
13
|
import {MockBuybackDataHook} from "./mock/MockBuybackDataHook.sol";
|
|
10
14
|
|
|
15
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
11
16
|
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
17
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
12
18
|
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
19
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
13
20
|
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
21
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
14
22
|
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
23
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
15
24
|
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
16
25
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
17
26
|
import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
@@ -30,6 +39,7 @@ import {JB721TiersHook} from "@bananapus/721-hook-v6/src/JB721TiersHook.sol";
|
|
|
30
39
|
import {JB721TiersHookStore} from "@bananapus/721-hook-v6/src/JB721TiersHookStore.sol";
|
|
31
40
|
import {JBAddressRegistry} from "@bananapus/address-registry-v6/src/JBAddressRegistry.sol";
|
|
32
41
|
import {IJBAddressRegistry} from "@bananapus/address-registry-v6/src/interfaces/IJBAddressRegistry.sol";
|
|
42
|
+
import {REVEmpty721Config} from "./helpers/REVEmpty721Config.sol";
|
|
33
43
|
|
|
34
44
|
/// @notice Contract that reenters REVLoans when it receives ETH during a borrow payout.
|
|
35
45
|
/// Records the loan state it observes during reentrancy to verify CEI correctness.
|
|
@@ -70,22 +80,36 @@ contract ReentrantBorrower {
|
|
|
70
80
|
/// None of the four helpers read loan.amount or loan.collateral — they all use pre-computed deltas.
|
|
71
81
|
/// The CEI fix writes loan.amount and loan.collateral BEFORE calling any of these helpers.
|
|
72
82
|
contract TestCEIPattern is TestBaseWorkflow {
|
|
83
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
73
84
|
bytes32 REV_DEPLOYER_SALT = "REVDeployer";
|
|
74
85
|
|
|
86
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
75
87
|
REVDeployer REV_DEPLOYER;
|
|
88
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
76
89
|
JB721TiersHook EXAMPLE_HOOK;
|
|
90
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
77
91
|
IJB721TiersHookDeployer HOOK_DEPLOYER;
|
|
92
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
78
93
|
IJB721TiersHookStore HOOK_STORE;
|
|
94
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
79
95
|
IJBAddressRegistry ADDRESS_REGISTRY;
|
|
96
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
80
97
|
IREVLoans LOANS_CONTRACT;
|
|
98
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
81
99
|
MockERC20 TOKEN;
|
|
100
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
82
101
|
IJBSuckerRegistry SUCKER_REGISTRY;
|
|
102
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
83
103
|
CTPublisher PUBLISHER;
|
|
104
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
84
105
|
MockBuybackDataHook MOCK_BUYBACK;
|
|
85
106
|
|
|
107
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
86
108
|
uint256 FEE_PROJECT_ID;
|
|
109
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
87
110
|
uint256 REVNET_ID;
|
|
88
111
|
|
|
112
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
89
113
|
address USER = makeAddr("user");
|
|
90
114
|
address private constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
91
115
|
|
|
@@ -94,8 +118,9 @@ contract TestCEIPattern is TestBaseWorkflow {
|
|
|
94
118
|
FEE_PROJECT_ID = jbProjects().createFor(multisig());
|
|
95
119
|
SUCKER_REGISTRY = new JBSuckerRegistry(jbDirectory(), jbPermissions(), multisig(), address(0));
|
|
96
120
|
HOOK_STORE = new JB721TiersHookStore();
|
|
97
|
-
EXAMPLE_HOOK =
|
|
98
|
-
|
|
121
|
+
EXAMPLE_HOOK = new JB721TiersHook(
|
|
122
|
+
jbDirectory(), jbPermissions(), jbPrices(), jbRulesets(), HOOK_STORE, jbSplits(), multisig()
|
|
123
|
+
);
|
|
99
124
|
ADDRESS_REGISTRY = new JBAddressRegistry();
|
|
100
125
|
HOOK_DEPLOYER = new JB721TiersHookDeployer(EXAMPLE_HOOK, HOOK_STORE, ADDRESS_REGISTRY, multisig());
|
|
101
126
|
PUBLISHER = new CTPublisher(jbDirectory(), jbPermissions(), FEE_PROJECT_ID, multisig());
|
|
@@ -156,6 +181,7 @@ contract TestCEIPattern is TestBaseWorkflow {
|
|
|
156
181
|
extraMetadata: 0
|
|
157
182
|
});
|
|
158
183
|
REVConfig memory cfg = REVConfig({
|
|
184
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
159
185
|
description: REVDescription("Revnet", "$REV", "ipfs://test", "REV_TOKEN"),
|
|
160
186
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
161
187
|
splitOperator: multisig(),
|
|
@@ -168,7 +194,9 @@ contract TestCEIPattern is TestBaseWorkflow {
|
|
|
168
194
|
terminalConfigurations: tc,
|
|
169
195
|
suckerDeploymentConfiguration: REVSuckerDeploymentConfig({
|
|
170
196
|
deployerConfigurations: new JBSuckerDeployerConfig[](0), salt: keccak256("FEE")
|
|
171
|
-
})
|
|
197
|
+
}),
|
|
198
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
199
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
172
200
|
});
|
|
173
201
|
}
|
|
174
202
|
|
|
@@ -200,18 +228,21 @@ contract TestCEIPattern is TestBaseWorkflow {
|
|
|
200
228
|
REVLoanSource[] memory ls = new REVLoanSource[](1);
|
|
201
229
|
ls[0] = REVLoanSource({token: JBConstants.NATIVE_TOKEN, terminal: jbMultiTerminal()});
|
|
202
230
|
REVConfig memory cfg = REVConfig({
|
|
231
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
203
232
|
description: REVDescription("NANA", "$NANA", "ipfs://test2", "NANA_TOKEN"),
|
|
204
233
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
205
234
|
splitOperator: multisig(),
|
|
206
235
|
stageConfigurations: stages
|
|
207
236
|
});
|
|
208
|
-
REVNET_ID = REV_DEPLOYER.deployFor({
|
|
237
|
+
(REVNET_ID,) = REV_DEPLOYER.deployFor({
|
|
209
238
|
revnetId: 0,
|
|
210
239
|
configuration: cfg,
|
|
211
240
|
terminalConfigurations: tc,
|
|
212
241
|
suckerDeploymentConfiguration: REVSuckerDeploymentConfig({
|
|
213
242
|
deployerConfigurations: new JBSuckerDeployerConfig[](0), salt: keccak256("NANA")
|
|
214
|
-
})
|
|
243
|
+
}),
|
|
244
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
245
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
215
246
|
});
|
|
216
247
|
}
|
|
217
248
|
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
4
5
|
import "forge-std/Test.sol";
|
|
6
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
5
7
|
import /* {*} from */ "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
|
|
6
|
-
import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
8
|
+
// import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
9
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
7
10
|
import /* {*} from */ "./../src/REVDeployer.sol";
|
|
11
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
8
12
|
import "@croptop/core-v6/src/CTPublisher.sol";
|
|
9
13
|
import {MockBuybackDataHook} from "./mock/MockBuybackDataHook.sol";
|
|
10
14
|
|
|
15
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
11
16
|
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
17
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
12
18
|
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
19
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
13
20
|
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
21
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
14
22
|
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
23
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
15
24
|
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
16
25
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
17
26
|
import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
18
|
-
import {MockPriceFeed} from "@bananapus/core-v6/test/mock/MockPriceFeed.sol";
|
|
19
27
|
import {MockERC20} from "@bananapus/core-v6/test/mock/MockERC20.sol";
|
|
20
28
|
import {REVLoans} from "../src/REVLoans.sol";
|
|
21
|
-
import {REVLoan} from "../src/structs/REVLoan.sol";
|
|
22
29
|
import {REVStageConfig, REVAutoIssuance} from "../src/structs/REVStageConfig.sol";
|
|
23
30
|
import {REVLoanSource} from "../src/structs/REVLoanSource.sol";
|
|
24
31
|
import {REVDescription} from "../src/structs/REVDescription.sol";
|
|
@@ -30,6 +37,7 @@ import {JB721TiersHook} from "@bananapus/721-hook-v6/src/JB721TiersHook.sol";
|
|
|
30
37
|
import {JB721TiersHookStore} from "@bananapus/721-hook-v6/src/JB721TiersHookStore.sol";
|
|
31
38
|
import {JBAddressRegistry} from "@bananapus/address-registry-v6/src/JBAddressRegistry.sol";
|
|
32
39
|
import {IJBAddressRegistry} from "@bananapus/address-registry-v6/src/interfaces/IJBAddressRegistry.sol";
|
|
40
|
+
import {REVEmpty721Config} from "./helpers/REVEmpty721Config.sol";
|
|
33
41
|
|
|
34
42
|
struct FeeProjectConfig {
|
|
35
43
|
REVConfig configuration;
|
|
@@ -38,24 +46,40 @@ struct FeeProjectConfig {
|
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
49
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
41
50
|
bytes32 REV_DEPLOYER_SALT = "REVDeployer";
|
|
51
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
42
52
|
bytes32 ERC20_SALT = "REV_TOKEN";
|
|
43
53
|
|
|
54
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
44
55
|
REVDeployer REV_DEPLOYER;
|
|
56
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
45
57
|
JB721TiersHook EXAMPLE_HOOK;
|
|
58
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
46
59
|
IJB721TiersHookDeployer HOOK_DEPLOYER;
|
|
60
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
47
61
|
IJB721TiersHookStore HOOK_STORE;
|
|
62
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
48
63
|
IJBAddressRegistry ADDRESS_REGISTRY;
|
|
64
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
49
65
|
IREVLoans LOANS_CONTRACT;
|
|
66
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
50
67
|
MockERC20 TOKEN;
|
|
68
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
51
69
|
IJBSuckerRegistry SUCKER_REGISTRY;
|
|
70
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
52
71
|
CTPublisher PUBLISHER;
|
|
72
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
53
73
|
MockBuybackDataHook MOCK_BUYBACK;
|
|
54
74
|
|
|
75
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
55
76
|
uint256 FEE_PROJECT_ID;
|
|
77
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
56
78
|
uint256 REVNET_ID;
|
|
57
79
|
|
|
80
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
58
81
|
address USER = makeAddr("user");
|
|
82
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
59
83
|
address RANDOM_CALLER = makeAddr("randomCaller");
|
|
60
84
|
|
|
61
85
|
address private constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
@@ -88,6 +112,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
88
112
|
autoIssuances: issuanceConfs,
|
|
89
113
|
splitPercent: 2000,
|
|
90
114
|
splits: splits,
|
|
115
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
91
116
|
initialIssuance: uint112(1000 * decimalMultiplier),
|
|
92
117
|
issuanceCutFrequency: 90 days,
|
|
93
118
|
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
@@ -97,6 +122,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
97
122
|
}
|
|
98
123
|
|
|
99
124
|
REVConfig memory revnetConfiguration = REVConfig({
|
|
125
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
100
126
|
description: REVDescription(name, symbol, projectUri, ERC20_SALT),
|
|
101
127
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
102
128
|
splitOperator: multisig(),
|
|
@@ -140,6 +166,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
140
166
|
autoIssuances: issuanceConfs,
|
|
141
167
|
splitPercent: 2000,
|
|
142
168
|
splits: splits,
|
|
169
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
143
170
|
initialIssuance: uint112(1000 * decimalMultiplier),
|
|
144
171
|
issuanceCutFrequency: 90 days,
|
|
145
172
|
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
@@ -152,6 +179,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
152
179
|
loanSources[0] = REVLoanSource({token: JBConstants.NATIVE_TOKEN, terminal: jbMultiTerminal()});
|
|
153
180
|
|
|
154
181
|
REVConfig memory revnetConfiguration = REVConfig({
|
|
182
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
155
183
|
description: REVDescription(name, symbol, projectUri, "NANA_TOKEN"),
|
|
156
184
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
157
185
|
splitOperator: multisig(),
|
|
@@ -173,8 +201,9 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
173
201
|
FEE_PROJECT_ID = jbProjects().createFor(multisig());
|
|
174
202
|
SUCKER_REGISTRY = new JBSuckerRegistry(jbDirectory(), jbPermissions(), multisig(), address(0));
|
|
175
203
|
HOOK_STORE = new JB721TiersHookStore();
|
|
176
|
-
EXAMPLE_HOOK =
|
|
177
|
-
|
|
204
|
+
EXAMPLE_HOOK = new JB721TiersHook(
|
|
205
|
+
jbDirectory(), jbPermissions(), jbPrices(), jbRulesets(), HOOK_STORE, jbSplits(), multisig()
|
|
206
|
+
);
|
|
178
207
|
ADDRESS_REGISTRY = new JBAddressRegistry();
|
|
179
208
|
HOOK_DEPLOYER = new JB721TiersHookDeployer(EXAMPLE_HOOK, HOOK_STORE, ADDRESS_REGISTRY, multisig());
|
|
180
209
|
PUBLISHER = new CTPublisher(jbDirectory(), jbPermissions(), FEE_PROJECT_ID, multisig());
|
|
@@ -212,16 +241,20 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
212
241
|
revnetId: FEE_PROJECT_ID,
|
|
213
242
|
configuration: feeProjectConfig.configuration,
|
|
214
243
|
terminalConfigurations: feeProjectConfig.terminalConfigurations,
|
|
215
|
-
suckerDeploymentConfiguration: feeProjectConfig.suckerDeploymentConfiguration
|
|
244
|
+
suckerDeploymentConfiguration: feeProjectConfig.suckerDeploymentConfiguration,
|
|
245
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
246
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
216
247
|
});
|
|
217
248
|
|
|
218
249
|
// Deploy the revnet.
|
|
219
250
|
FeeProjectConfig memory revnetConfig = getRevnetConfig();
|
|
220
|
-
REVNET_ID = REV_DEPLOYER.deployFor({
|
|
251
|
+
(REVNET_ID,) = REV_DEPLOYER.deployFor({
|
|
221
252
|
revnetId: 0,
|
|
222
253
|
configuration: revnetConfig.configuration,
|
|
223
254
|
terminalConfigurations: revnetConfig.terminalConfigurations,
|
|
224
|
-
suckerDeploymentConfiguration: revnetConfig.suckerDeploymentConfiguration
|
|
255
|
+
suckerDeploymentConfiguration: revnetConfig.suckerDeploymentConfiguration,
|
|
256
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
257
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
225
258
|
});
|
|
226
259
|
|
|
227
260
|
vm.deal(USER, 100 ether);
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
4
5
|
import "forge-std/Test.sol";
|
|
6
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
5
7
|
import /* {*} from */ "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
|
|
6
|
-
import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
8
|
+
// import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
9
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
7
10
|
import /* {*} from */ "./../src/REVDeployer.sol";
|
|
11
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
8
12
|
import "@croptop/core-v6/src/CTPublisher.sol";
|
|
9
13
|
import {MockBuybackDataHook} from "./mock/MockBuybackDataHook.sol";
|
|
14
|
+
import {REVEmpty721Config} from "./helpers/REVEmpty721Config.sol";
|
|
10
15
|
|
|
16
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
11
17
|
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
18
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
12
19
|
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
20
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
13
21
|
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
22
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
14
23
|
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
24
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
15
25
|
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
16
26
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
17
27
|
import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
18
|
-
import {MockPriceFeed} from "@bananapus/core-v6/test/mock/MockPriceFeed.sol";
|
|
19
28
|
import {MockERC20} from "@bananapus/core-v6/test/mock/MockERC20.sol";
|
|
20
29
|
import {REVLoans} from "../src/REVLoans.sol";
|
|
21
|
-
import {REVLoan} from "../src/structs/REVLoan.sol";
|
|
22
30
|
import {REVStageConfig, REVAutoIssuance} from "../src/structs/REVStageConfig.sol";
|
|
23
|
-
import {REVLoanSource} from "../src/structs/REVLoanSource.sol";
|
|
24
31
|
import {REVDescription} from "../src/structs/REVDescription.sol";
|
|
25
32
|
import {IREVLoans} from "./../src/interfaces/IREVLoans.sol";
|
|
26
33
|
import {JBSuckerDeployerConfig} from "@bananapus/suckers-v6/src/structs/JBSuckerDeployerConfig.sol";
|
|
@@ -32,22 +39,36 @@ import {JBAddressRegistry} from "@bananapus/address-registry-v6/src/JBAddressReg
|
|
|
32
39
|
import {IJBAddressRegistry} from "@bananapus/address-registry-v6/src/interfaces/IJBAddressRegistry.sol";
|
|
33
40
|
|
|
34
41
|
contract TestConversionDocumentation is TestBaseWorkflow {
|
|
42
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
35
43
|
bytes32 REV_DEPLOYER_SALT = "REVDeployer";
|
|
44
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
36
45
|
bytes32 ERC20_SALT = "REV_TOKEN";
|
|
37
46
|
|
|
47
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
38
48
|
REVDeployer REV_DEPLOYER;
|
|
49
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
39
50
|
JB721TiersHook EXAMPLE_HOOK;
|
|
51
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
40
52
|
IJB721TiersHookDeployer HOOK_DEPLOYER;
|
|
53
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
41
54
|
IJB721TiersHookStore HOOK_STORE;
|
|
55
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
42
56
|
IJBAddressRegistry ADDRESS_REGISTRY;
|
|
57
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
43
58
|
IREVLoans LOANS_CONTRACT;
|
|
59
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
44
60
|
MockERC20 TOKEN;
|
|
61
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
45
62
|
IJBSuckerRegistry SUCKER_REGISTRY;
|
|
63
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
46
64
|
CTPublisher PUBLISHER;
|
|
65
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
47
66
|
MockBuybackDataHook MOCK_BUYBACK;
|
|
48
67
|
|
|
68
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
49
69
|
uint256 FEE_PROJECT_ID;
|
|
50
70
|
|
|
71
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
51
72
|
address USER = makeAddr("user");
|
|
52
73
|
|
|
53
74
|
address private constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
@@ -87,6 +108,7 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
87
108
|
autoIssuances: new REVAutoIssuance[](0),
|
|
88
109
|
splitPercent: 2000,
|
|
89
110
|
splits: splits,
|
|
111
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
90
112
|
initialIssuance: uint112(1000 * decimalMultiplier),
|
|
91
113
|
issuanceCutFrequency: 90 days,
|
|
92
114
|
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
@@ -95,6 +117,7 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
95
117
|
});
|
|
96
118
|
|
|
97
119
|
configuration = REVConfig({
|
|
120
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
98
121
|
description: REVDescription(name, symbol, "ipfs://test", salt),
|
|
99
122
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
100
123
|
splitOperator: multisig(),
|
|
@@ -112,8 +135,9 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
112
135
|
FEE_PROJECT_ID = jbProjects().createFor(multisig());
|
|
113
136
|
SUCKER_REGISTRY = new JBSuckerRegistry(jbDirectory(), jbPermissions(), multisig(), address(0));
|
|
114
137
|
HOOK_STORE = new JB721TiersHookStore();
|
|
115
|
-
EXAMPLE_HOOK =
|
|
116
|
-
|
|
138
|
+
EXAMPLE_HOOK = new JB721TiersHook(
|
|
139
|
+
jbDirectory(), jbPermissions(), jbPrices(), jbRulesets(), HOOK_STORE, jbSplits(), multisig()
|
|
140
|
+
);
|
|
117
141
|
ADDRESS_REGISTRY = new JBAddressRegistry();
|
|
118
142
|
HOOK_DEPLOYER = new JB721TiersHookDeployer(EXAMPLE_HOOK, HOOK_STORE, ADDRESS_REGISTRY, multisig());
|
|
119
143
|
PUBLISHER = new CTPublisher(jbDirectory(), jbPermissions(), FEE_PROJECT_ID, multisig());
|
|
@@ -152,7 +176,9 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
152
176
|
revnetId: FEE_PROJECT_ID,
|
|
153
177
|
configuration: cfg,
|
|
154
178
|
terminalConfigurations: terms,
|
|
155
|
-
suckerDeploymentConfiguration: suckerCfg
|
|
179
|
+
suckerDeploymentConfiguration: suckerCfg,
|
|
180
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
181
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
156
182
|
});
|
|
157
183
|
}
|
|
158
184
|
|
|
@@ -172,11 +198,13 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
172
198
|
|
|
173
199
|
// Deploy as revnet — should succeed since project is blank.
|
|
174
200
|
vm.prank(USER);
|
|
175
|
-
uint256 deployed = REV_DEPLOYER.deployFor({
|
|
201
|
+
(uint256 deployed,) = REV_DEPLOYER.deployFor({
|
|
176
202
|
revnetId: blankId,
|
|
177
203
|
configuration: cfg,
|
|
178
204
|
terminalConfigurations: terms,
|
|
179
|
-
suckerDeploymentConfiguration: suckerCfg
|
|
205
|
+
suckerDeploymentConfiguration: suckerCfg,
|
|
206
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
207
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
180
208
|
});
|
|
181
209
|
|
|
182
210
|
assertEq(deployed, blankId, "Should return the same project ID");
|
|
@@ -253,7 +281,9 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
253
281
|
revnetId: projectId,
|
|
254
282
|
configuration: cfg,
|
|
255
283
|
terminalConfigurations: terms2,
|
|
256
|
-
suckerDeploymentConfiguration: suckerCfg
|
|
284
|
+
suckerDeploymentConfiguration: suckerCfg,
|
|
285
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
286
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
257
287
|
});
|
|
258
288
|
}
|
|
259
289
|
|
|
@@ -277,7 +307,9 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
277
307
|
revnetId: blankId,
|
|
278
308
|
configuration: cfg,
|
|
279
309
|
terminalConfigurations: terms,
|
|
280
|
-
suckerDeploymentConfiguration: suckerCfg
|
|
310
|
+
suckerDeploymentConfiguration: suckerCfg,
|
|
311
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
312
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
281
313
|
});
|
|
282
314
|
|
|
283
315
|
// Verify the project's owner is now the REVDeployer (NFT transferred permanently).
|
|
@@ -292,8 +324,13 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
292
324
|
(REVConfig memory cfg, JBTerminalConfig[] memory terms, REVSuckerDeploymentConfig memory suckerCfg) =
|
|
293
325
|
_getRevnetConfig("NewRevnet", "$NEW", "NEW_TOKEN");
|
|
294
326
|
|
|
295
|
-
uint256 newId = REV_DEPLOYER.deployFor({
|
|
296
|
-
revnetId: 0,
|
|
327
|
+
(uint256 newId,) = REV_DEPLOYER.deployFor({
|
|
328
|
+
revnetId: 0,
|
|
329
|
+
configuration: cfg,
|
|
330
|
+
terminalConfigurations: terms,
|
|
331
|
+
suckerDeploymentConfiguration: suckerCfg,
|
|
332
|
+
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
333
|
+
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
297
334
|
});
|
|
298
335
|
|
|
299
336
|
// Verify the project was created (ID > fee project).
|