@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
package/script/Deploy.s.sol
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
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 "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
6
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
5
7
|
import "@bananapus/buyback-hook-v6/script/helpers/BuybackDeploymentLib.sol";
|
|
8
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
6
9
|
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
10
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
7
11
|
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
12
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
8
13
|
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
14
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
9
15
|
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
10
16
|
|
|
11
17
|
import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
|
|
@@ -20,7 +26,6 @@ import {JBTokenMapping} from "@bananapus/suckers-v6/src/structs/JBTokenMapping.s
|
|
|
20
26
|
import {IPermit2} from "@uniswap/permit2/src/interfaces/IPermit2.sol";
|
|
21
27
|
import {IJBSplitHook} from "@bananapus/core-v6/src/interfaces/IJBSplitHook.sol";
|
|
22
28
|
import {IJBTerminal} from "@bananapus/core-v6/src/interfaces/IJBTerminal.sol";
|
|
23
|
-
import {IJBRulesetDataHook} from "@bananapus/core-v6/src/interfaces/IJBRulesetDataHook.sol";
|
|
24
29
|
import {IJBBuybackHookRegistry} from "@bananapus/buyback-hook-v6/src/interfaces/IJBBuybackHookRegistry.sol";
|
|
25
30
|
import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
26
31
|
|
|
@@ -30,12 +35,21 @@ import {REVConfig} from "../src/structs/REVConfig.sol";
|
|
|
30
35
|
import {REVDescription} from "../src/structs/REVDescription.sol";
|
|
31
36
|
import {REVStageConfig} from "../src/structs/REVStageConfig.sol";
|
|
32
37
|
import {REVSuckerDeploymentConfig} from "../src/structs/REVSuckerDeploymentConfig.sol";
|
|
33
|
-
import {REVLoans
|
|
38
|
+
import {REVLoans} from "./../src/REVLoans.sol";
|
|
39
|
+
import {REVDeploy721TiersHookConfig} from "../src/structs/REVDeploy721TiersHookConfig.sol";
|
|
40
|
+
import {REVCroptopAllowedPost} from "../src/structs/REVCroptopAllowedPost.sol";
|
|
41
|
+
import {IJB721TokenUriResolver} from "@bananapus/721-hook-v6/src/interfaces/IJB721TokenUriResolver.sol";
|
|
42
|
+
import {JB721InitTiersConfig} from "@bananapus/721-hook-v6/src/structs/JB721InitTiersConfig.sol";
|
|
43
|
+
import {JB721TierConfig} from "@bananapus/721-hook-v6/src/structs/JB721TierConfig.sol";
|
|
44
|
+
import {REVBaseline721HookConfig} from "../src/structs/REVBaseline721HookConfig.sol";
|
|
45
|
+
import {REV721TiersHookFlags} from "../src/structs/REV721TiersHookFlags.sol";
|
|
34
46
|
|
|
35
47
|
struct FeeProjectConfig {
|
|
36
48
|
REVConfig configuration;
|
|
37
49
|
JBTerminalConfig[] terminalConfigurations;
|
|
38
50
|
REVSuckerDeploymentConfig suckerDeploymentConfiguration;
|
|
51
|
+
REVDeploy721TiersHookConfig tiered721HookConfiguration;
|
|
52
|
+
REVCroptopAllowedPost[] allowedPosts;
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
contract DeployScript is Script, Sphinx {
|
|
@@ -52,26 +66,47 @@ contract DeployScript is Script, Sphinx {
|
|
|
52
66
|
/// @notice tracks the deployment of the router terminal.
|
|
53
67
|
RouterTerminalDeployment routerTerminal;
|
|
54
68
|
|
|
69
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
55
70
|
uint32 PREMINT_CHAIN_ID = 1;
|
|
71
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
56
72
|
string NAME = "Revnet";
|
|
73
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
57
74
|
string SYMBOL = "REV";
|
|
75
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
58
76
|
string PROJECT_URI = "ipfs://QmcCBD5fM927LjkLDSJWtNEU9FohcbiPSfqtGRHXFHzJ4W";
|
|
77
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
59
78
|
uint32 NATIVE_CURRENCY = uint32(uint160(JBConstants.NATIVE_TOKEN));
|
|
79
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
60
80
|
uint32 ETH_CURRENCY = JBCurrencyIds.ETH;
|
|
81
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
61
82
|
uint8 DECIMALS = 18;
|
|
83
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
62
84
|
uint256 DECIMAL_MULTIPLIER = 10 ** DECIMALS;
|
|
85
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
63
86
|
bytes32 ERC20_SALT = "_REV_ERC20_SALT_V6_";
|
|
87
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
64
88
|
bytes32 SUCKER_SALT = "_REV_SUCKER_SALT_V6_";
|
|
89
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
65
90
|
bytes32 DEPLOYER_SALT = "_REV_DEPLOYER_SALT_V6_";
|
|
91
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
66
92
|
bytes32 REVLOANS_SALT = "_REV_LOANS_SALT_V6_";
|
|
93
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
67
94
|
address LOANS_OWNER;
|
|
95
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
68
96
|
address OPERATOR;
|
|
97
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
69
98
|
address TRUSTED_FORWARDER;
|
|
99
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
70
100
|
IPermit2 PERMIT2;
|
|
101
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
71
102
|
uint48 REV_START_TIME = 1_740_089_444;
|
|
103
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
72
104
|
uint104 REV_MAINNET_AUTO_ISSUANCE_ = 1_050_482_341_387_116_262_330_122;
|
|
105
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
73
106
|
uint104 REV_BASE_AUTO_ISSUANCE_ = 38_544_322_230_437_559_731_228;
|
|
107
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
74
108
|
uint104 REV_OP_AUTO_ISSUANCE_ = 32_069_388_242_375_817_844;
|
|
109
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
75
110
|
uint104 REV_ARB_AUTO_ISSUANCE_ = 3_479_431_776_906_850_000_000;
|
|
76
111
|
|
|
77
112
|
function configureSphinx() public override {
|
|
@@ -90,32 +125,43 @@ contract DeployScript is Script, Sphinx {
|
|
|
90
125
|
// Get the deployment addresses for the nana CORE for this chain.
|
|
91
126
|
// We want to do this outside of the `sphinx` modifier.
|
|
92
127
|
core = CoreDeploymentLib.getDeployment(
|
|
93
|
-
vm.envOr(
|
|
128
|
+
vm.envOr({
|
|
129
|
+
name: "NANA_CORE_DEPLOYMENT_PATH", defaultValue: string("node_modules/@bananapus/core-v6/deployments/")
|
|
130
|
+
})
|
|
94
131
|
);
|
|
95
132
|
// Get the deployment addresses for the suckers contracts for this chain.
|
|
96
133
|
suckers = SuckerDeploymentLib.getDeployment(
|
|
97
|
-
vm.envOr(
|
|
134
|
+
vm.envOr({
|
|
135
|
+
name: "NANA_SUCKERS_DEPLOYMENT_PATH",
|
|
136
|
+
defaultValue: string("node_modules/@bananapus/suckers-v6/deployments/")
|
|
137
|
+
})
|
|
98
138
|
);
|
|
99
139
|
// Get the deployment addresses for the 721 hook contracts for this chain.
|
|
100
140
|
croptop = CroptopDeploymentLib.getDeployment(
|
|
101
|
-
vm.envOr(
|
|
141
|
+
vm.envOr({
|
|
142
|
+
name: "CROPTOP_CORE_DEPLOYMENT_PATH", defaultValue: string("node_modules/@croptop/core-v6/deployments/")
|
|
143
|
+
})
|
|
102
144
|
);
|
|
103
145
|
// Get the deployment addresses for the 721 hook contracts for this chain.
|
|
104
146
|
hook = Hook721DeploymentLib.getDeployment(
|
|
105
|
-
vm.envOr(
|
|
147
|
+
vm.envOr({
|
|
148
|
+
name: "NANA_721_DEPLOYMENT_PATH",
|
|
149
|
+
defaultValue: string("node_modules/@bananapus/721-hook-v6/deployments/")
|
|
150
|
+
})
|
|
106
151
|
);
|
|
107
152
|
// Get the deployment addresses for the router terminal contracts for this chain.
|
|
108
153
|
routerTerminal = RouterTerminalDeploymentLib.getDeployment(
|
|
109
|
-
vm.envOr(
|
|
110
|
-
"NANA_ROUTER_TERMINAL_DEPLOYMENT_PATH",
|
|
111
|
-
string("node_modules/@bananapus/router-terminal-v6/deployments/")
|
|
112
|
-
)
|
|
154
|
+
vm.envOr({
|
|
155
|
+
name: "NANA_ROUTER_TERMINAL_DEPLOYMENT_PATH",
|
|
156
|
+
defaultValue: string("node_modules/@bananapus/router-terminal-v6/deployments/")
|
|
157
|
+
})
|
|
113
158
|
);
|
|
114
159
|
// Get the deployment addresses for the 721 hook contracts for this chain.
|
|
115
160
|
buybackHook = BuybackDeploymentLib.getDeployment(
|
|
116
|
-
vm.envOr(
|
|
117
|
-
"NANA_BUYBACK_HOOK_DEPLOYMENT_PATH",
|
|
118
|
-
|
|
161
|
+
vm.envOr({
|
|
162
|
+
name: "NANA_BUYBACK_HOOK_DEPLOYMENT_PATH",
|
|
163
|
+
defaultValue: string("node_modules/@bananapus/buyback-hook-v6/deployments/")
|
|
164
|
+
})
|
|
119
165
|
);
|
|
120
166
|
|
|
121
167
|
// We use the same trusted forwarder and permit2 as the core deployment.
|
|
@@ -169,6 +215,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
169
215
|
autoIssuances: issuanceConfs,
|
|
170
216
|
splitPercent: 3800, // 38%
|
|
171
217
|
splits: splits,
|
|
218
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
172
219
|
initialIssuance: uint112(10_000 * DECIMAL_MULTIPLIER),
|
|
173
220
|
issuanceCutFrequency: 90 days,
|
|
174
221
|
issuanceCutPercent: 380_000_000, // 38%
|
|
@@ -180,7 +227,11 @@ contract DeployScript is Script, Sphinx {
|
|
|
180
227
|
{
|
|
181
228
|
REVAutoIssuance[] memory issuanceConfs = new REVAutoIssuance[](1);
|
|
182
229
|
issuanceConfs[0] = REVAutoIssuance({
|
|
183
|
-
|
|
230
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
231
|
+
chainId: PREMINT_CHAIN_ID,
|
|
232
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
233
|
+
count: uint104(1_550_000 * DECIMAL_MULTIPLIER),
|
|
234
|
+
beneficiary: OPERATOR
|
|
184
235
|
});
|
|
185
236
|
|
|
186
237
|
stageConfigurations[1] = REVStageConfig({
|
|
@@ -210,7 +261,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
210
261
|
|
|
211
262
|
// The project's revnet configuration
|
|
212
263
|
REVConfig memory revnetConfiguration = REVConfig({
|
|
213
|
-
description: REVDescription(NAME, SYMBOL, PROJECT_URI, ERC20_SALT),
|
|
264
|
+
description: REVDescription({name: NAME, ticker: SYMBOL, uri: PROJECT_URI, salt: ERC20_SALT}),
|
|
214
265
|
baseCurrency: ETH_CURRENCY,
|
|
215
266
|
splitOperator: OPERATOR,
|
|
216
267
|
stageConfigurations: stageConfigurations
|
|
@@ -220,9 +271,8 @@ contract DeployScript is Script, Sphinx {
|
|
|
220
271
|
JBTokenMapping[] memory tokenMappings = new JBTokenMapping[](1);
|
|
221
272
|
tokenMappings[0] = JBTokenMapping({
|
|
222
273
|
localToken: JBConstants.NATIVE_TOKEN,
|
|
223
|
-
remoteToken: bytes32(uint256(uint160(JBConstants.NATIVE_TOKEN))),
|
|
224
274
|
minGas: 200_000,
|
|
225
|
-
|
|
275
|
+
remoteToken: bytes32(uint256(uint160(JBConstants.NATIVE_TOKEN)))
|
|
226
276
|
});
|
|
227
277
|
|
|
228
278
|
REVSuckerDeploymentConfig memory suckerDeploymentConfiguration;
|
|
@@ -262,20 +312,48 @@ contract DeployScript is Script, Sphinx {
|
|
|
262
312
|
return FeeProjectConfig({
|
|
263
313
|
configuration: revnetConfiguration,
|
|
264
314
|
terminalConfigurations: terminalConfigurations,
|
|
265
|
-
suckerDeploymentConfiguration: suckerDeploymentConfiguration
|
|
315
|
+
suckerDeploymentConfiguration: suckerDeploymentConfiguration,
|
|
316
|
+
tiered721HookConfiguration: REVDeploy721TiersHookConfig({
|
|
317
|
+
baseline721HookConfiguration: REVBaseline721HookConfig({
|
|
318
|
+
name: "",
|
|
319
|
+
symbol: "",
|
|
320
|
+
baseUri: "",
|
|
321
|
+
tokenUriResolver: IJB721TokenUriResolver(address(0)),
|
|
322
|
+
contractUri: "",
|
|
323
|
+
tiersConfig: JB721InitTiersConfig({
|
|
324
|
+
tiers: new JB721TierConfig[](0), currency: ETH_CURRENCY, decimals: 18
|
|
325
|
+
}),
|
|
326
|
+
reserveBeneficiary: address(0),
|
|
327
|
+
flags: REV721TiersHookFlags({
|
|
328
|
+
noNewTiersWithReserves: false,
|
|
329
|
+
noNewTiersWithVotes: false,
|
|
330
|
+
noNewTiersWithOwnerMinting: false,
|
|
331
|
+
preventOverspending: false
|
|
332
|
+
})
|
|
333
|
+
}),
|
|
334
|
+
salt: bytes32(0),
|
|
335
|
+
preventSplitOperatorAdjustingTiers: false,
|
|
336
|
+
preventSplitOperatorUpdatingMetadata: false,
|
|
337
|
+
preventSplitOperatorMinting: false,
|
|
338
|
+
preventSplitOperatorIncreasingDiscountPercent: false
|
|
339
|
+
}),
|
|
340
|
+
allowedPosts: new REVCroptopAllowedPost[](0)
|
|
266
341
|
});
|
|
267
342
|
}
|
|
268
343
|
|
|
269
344
|
function deploy() public sphinx {
|
|
270
345
|
// TODO figure out how to reference project ID if the contracts are already deployed.
|
|
346
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
271
347
|
uint256 FEE_PROJECT_ID = core.projects.createFor(safeAddress());
|
|
272
348
|
|
|
273
349
|
// Deploy REVLoans first — it only depends on the controller.
|
|
274
|
-
(address _revloansAddr, bool _revloansIsDeployed) = _isDeployed(
|
|
275
|
-
REVLOANS_SALT,
|
|
276
|
-
type(REVLoans).creationCode,
|
|
277
|
-
abi.encode(
|
|
278
|
-
|
|
350
|
+
(address _revloansAddr, bool _revloansIsDeployed) = _isDeployed({
|
|
351
|
+
salt: REVLOANS_SALT,
|
|
352
|
+
creationCode: type(REVLoans).creationCode,
|
|
353
|
+
arguments: abi.encode(
|
|
354
|
+
core.controller, core.projects, FEE_PROJECT_ID, LOANS_OWNER, PERMIT2, TRUSTED_FORWARDER
|
|
355
|
+
)
|
|
356
|
+
});
|
|
279
357
|
REVLoans revloans = _revloansIsDeployed
|
|
280
358
|
? REVLoans(payable(_revloansAddr))
|
|
281
359
|
: new REVLoans{salt: REVLOANS_SALT}({
|
|
@@ -288,10 +366,10 @@ contract DeployScript is Script, Sphinx {
|
|
|
288
366
|
});
|
|
289
367
|
|
|
290
368
|
// Deploy REVDeployer with the REVLoans and buyback hook addresses.
|
|
291
|
-
(address _deployerAddr, bool _deployerIsDeployed) = _isDeployed(
|
|
292
|
-
DEPLOYER_SALT,
|
|
293
|
-
type(REVDeployer).creationCode,
|
|
294
|
-
abi.encode(
|
|
369
|
+
(address _deployerAddr, bool _deployerIsDeployed) = _isDeployed({
|
|
370
|
+
salt: DEPLOYER_SALT,
|
|
371
|
+
creationCode: type(REVDeployer).creationCode,
|
|
372
|
+
arguments: abi.encode(
|
|
295
373
|
core.controller,
|
|
296
374
|
suckers.registry,
|
|
297
375
|
FEE_PROJECT_ID,
|
|
@@ -301,22 +379,22 @@ contract DeployScript is Script, Sphinx {
|
|
|
301
379
|
address(revloans),
|
|
302
380
|
TRUSTED_FORWARDER
|
|
303
381
|
)
|
|
304
|
-
);
|
|
382
|
+
});
|
|
305
383
|
REVDeployer _basicDeployer = _deployerIsDeployed
|
|
306
384
|
? REVDeployer(payable(_deployerAddr))
|
|
307
|
-
: new REVDeployer{salt: DEPLOYER_SALT}(
|
|
308
|
-
core.controller,
|
|
309
|
-
suckers.registry,
|
|
310
|
-
FEE_PROJECT_ID,
|
|
311
|
-
hook.hook_deployer,
|
|
312
|
-
croptop.publisher,
|
|
313
|
-
IJBBuybackHookRegistry(address(buybackHook.registry)),
|
|
314
|
-
address(revloans),
|
|
315
|
-
TRUSTED_FORWARDER
|
|
316
|
-
);
|
|
385
|
+
: new REVDeployer{salt: DEPLOYER_SALT}({
|
|
386
|
+
controller: core.controller,
|
|
387
|
+
suckerRegistry: suckers.registry,
|
|
388
|
+
feeRevnetId: FEE_PROJECT_ID,
|
|
389
|
+
hookDeployer: hook.hook_deployer,
|
|
390
|
+
publisher: croptop.publisher,
|
|
391
|
+
buybackHook: IJBBuybackHookRegistry(address(buybackHook.registry)),
|
|
392
|
+
loans: address(revloans),
|
|
393
|
+
trustedForwarder: TRUSTED_FORWARDER
|
|
394
|
+
});
|
|
317
395
|
|
|
318
396
|
// Approve the basic deployer to configure the project.
|
|
319
|
-
core.projects.approve(address(_basicDeployer), FEE_PROJECT_ID);
|
|
397
|
+
core.projects.approve({to: address(_basicDeployer), tokenId: FEE_PROJECT_ID});
|
|
320
398
|
|
|
321
399
|
// Build the config.
|
|
322
400
|
FeeProjectConfig memory feeProjectConfig = getFeeProjectConfig();
|
|
@@ -326,7 +404,9 @@ contract DeployScript is Script, Sphinx {
|
|
|
326
404
|
revnetId: FEE_PROJECT_ID,
|
|
327
405
|
configuration: feeProjectConfig.configuration,
|
|
328
406
|
terminalConfigurations: feeProjectConfig.terminalConfigurations,
|
|
329
|
-
suckerDeploymentConfiguration: feeProjectConfig.suckerDeploymentConfiguration
|
|
407
|
+
suckerDeploymentConfiguration: feeProjectConfig.suckerDeploymentConfiguration,
|
|
408
|
+
tiered721HookConfiguration: feeProjectConfig.tiered721HookConfiguration,
|
|
409
|
+
allowedPosts: feeProjectConfig.allowedPosts
|
|
330
410
|
});
|
|
331
411
|
}
|
|
332
412
|
|
|
@@ -339,6 +419,10 @@ contract DeployScript is Script, Sphinx {
|
|
|
339
419
|
view
|
|
340
420
|
returns (address deployedTo, bool isDeployed)
|
|
341
421
|
{
|
|
422
|
+
// Note: This uses the Arachnid deterministic-deployment-proxy address, which differs from
|
|
423
|
+
// the Sphinx deployer used at runtime. As a result, the predicted address won't match and
|
|
424
|
+
// _isDeployed will always return false when deploying via Sphinx. This is benign — it just
|
|
425
|
+
// means contracts are always freshly deployed rather than skipped.
|
|
342
426
|
address _deployedTo = vm.computeCreate2Address({
|
|
343
427
|
salt: salt,
|
|
344
428
|
initCodeHash: keccak256(abi.encodePacked(creationCode, arguments)),
|
|
@@ -9,6 +9,7 @@ import {IREVDeployer} from "./../../src/interfaces/IREVDeployer.sol";
|
|
|
9
9
|
import {IREVLoans} from "./../../src/interfaces/IREVLoans.sol";
|
|
10
10
|
|
|
11
11
|
struct RevnetCoreDeployment {
|
|
12
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
12
13
|
IREVDeployer basic_deployer;
|
|
13
14
|
IREVLoans loans;
|
|
14
15
|
}
|
|
@@ -16,6 +17,7 @@ struct RevnetCoreDeployment {
|
|
|
16
17
|
library RevnetCoreDeploymentLib {
|
|
17
18
|
// Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.
|
|
18
19
|
address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code"))));
|
|
20
|
+
// forge-lint: disable-next-line(screaming-snake-case-const)
|
|
19
21
|
Vm internal constant vm = Vm(VM_ADDRESS);
|
|
20
22
|
|
|
21
23
|
function getDeployment(string memory path) internal returns (RevnetCoreDeployment memory deployment) {
|
|
@@ -29,7 +31,7 @@ library RevnetCoreDeploymentLib {
|
|
|
29
31
|
|
|
30
32
|
for (uint256 _i; _i < networks.length; _i++) {
|
|
31
33
|
if (networks[_i].chainId == chainId) {
|
|
32
|
-
return getDeployment(path, networks[_i].name);
|
|
34
|
+
return getDeployment({path: path, network_name: networks[_i].name});
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -38,16 +40,24 @@ library RevnetCoreDeploymentLib {
|
|
|
38
40
|
|
|
39
41
|
function getDeployment(
|
|
40
42
|
string memory path,
|
|
43
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
41
44
|
string memory network_name
|
|
42
45
|
)
|
|
43
46
|
internal
|
|
44
47
|
view
|
|
45
48
|
returns (RevnetCoreDeployment memory deployment)
|
|
46
49
|
{
|
|
47
|
-
deployment.basic_deployer =
|
|
48
|
-
|
|
50
|
+
deployment.basic_deployer = IREVDeployer(
|
|
51
|
+
_getDeploymentAddress({
|
|
52
|
+
path: path, project_name: "revnet-core-v6", network_name: network_name, contractName: "REVDeployer"
|
|
53
|
+
})
|
|
54
|
+
);
|
|
49
55
|
|
|
50
|
-
deployment.loans = IREVLoans(
|
|
56
|
+
deployment.loans = IREVLoans(
|
|
57
|
+
_getDeploymentAddress({
|
|
58
|
+
path: path, project_name: "revnet-core-v6", network_name: network_name, contractName: "REVLoans"
|
|
59
|
+
})
|
|
60
|
+
);
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
/// @notice Get the address of a contract that was deployed by the Deploy script.
|
|
@@ -57,7 +67,9 @@ library RevnetCoreDeploymentLib {
|
|
|
57
67
|
/// @return The address of the contract.
|
|
58
68
|
function _getDeploymentAddress(
|
|
59
69
|
string memory path,
|
|
70
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
60
71
|
string memory project_name,
|
|
72
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
61
73
|
string memory network_name,
|
|
62
74
|
string memory contractName
|
|
63
75
|
)
|
|
@@ -66,7 +78,8 @@ library RevnetCoreDeploymentLib {
|
|
|
66
78
|
returns (address)
|
|
67
79
|
{
|
|
68
80
|
string memory deploymentJson =
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
// forge-lint: disable-next-line(unsafe-cheatcode)
|
|
82
|
+
vm.readFile(string.concat(path, project_name, "/", network_name, "/", contractName, ".json"));
|
|
83
|
+
return stdJson.readAddress({json: deploymentJson, key: ".address"});
|
|
71
84
|
}
|
|
72
85
|
}
|