@rev-net/core-v6 0.0.12 → 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/AUDIT_INSTRUCTIONS.md +295 -0
- package/CHANGE_LOG.md +316 -0
- package/README.md +2 -2
- package/RISKS.md +180 -35
- package/SKILLS.md +1 -1
- package/USER_JOURNEYS.md +489 -0
- package/package.json +9 -9
- package/script/Deploy.s.sol +40 -6
- package/script/helpers/RevnetCoreDeploymentLib.sol +7 -1
- package/src/REVDeployer.sol +63 -47
- package/src/REVLoans.sol +51 -15
- package/src/interfaces/IREVDeployer.sol +0 -1
- 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 +1 -0
- 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 +132 -12
- package/test/REVAutoIssuanceFuzz.t.sol +23 -3
- package/test/REVDeployerRegressions.t.sol +35 -4
- package/test/REVInvincibility.t.sol +58 -8
- package/test/REVInvincibilityHandler.sol +29 -0
- package/test/REVLifecycle.t.sol +28 -3
- package/test/REVLoans.invariants.t.sol +52 -5
- package/test/REVLoansAttacks.t.sol +43 -5
- package/test/REVLoansFeeRecovery.t.sol +50 -11
- package/test/REVLoansFindings.t.sol +27 -3
- package/test/REVLoansRegressions.t.sol +25 -3
- package/test/REVLoansSourceFeeRecovery.t.sol +491 -0
- package/test/REVLoansSourced.t.sol +56 -7
- package/test/REVLoansUnSourced.t.sol +49 -5
- package/test/TestBurnHeldTokens.t.sol +32 -5
- package/test/TestCEIPattern.t.sol +26 -2
- package/test/TestCashOutCallerValidation.t.sol +30 -4
- package/test/TestConversionDocumentation.t.sol +26 -5
- package/test/TestCrossCurrencyReclaim.t.sol +584 -0
- package/test/TestCrossSourceReallocation.t.sol +26 -2
- package/test/TestERC2771MetaTx.t.sol +557 -0
- package/test/TestEmptyBuybackSpecs.t.sol +23 -3
- package/test/TestFlashLoanSurplus.t.sol +28 -3
- package/test/TestHookArrayOOB.t.sol +24 -4
- package/test/TestLiquidationBehavior.t.sol +26 -3
- package/test/TestLoanSourceRotation.t.sol +525 -0
- package/test/TestLongTailEconomics.t.sol +651 -0
- package/test/TestLowFindings.t.sol +65 -2
- package/test/TestMixedFixes.t.sol +28 -3
- 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 +24 -2
- package/test/TestSplitWeightE2E.t.sol +29 -2
- package/test/TestSplitWeightFork.t.sol +46 -7
- package/test/TestStageTransitionBorrowable.t.sol +24 -2
- package/test/TestSwapTerminalPermission.t.sol +23 -3
- package/test/TestUint112Overflow.t.sol +28 -2
- package/test/TestZeroRepayment.t.sol +26 -2
- package/test/fork/ForkTestBase.sol +46 -3
- package/test/fork/TestCashOutFork.t.sol +1 -1
- package/test/fork/TestLoanBorrowFork.t.sol +1 -0
- package/test/fork/TestLoanCrossRulesetFork.t.sol +3 -1
- 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 +1 -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 +27 -4
- package/test/regression/TestLiquidateGapHandling.t.sol +29 -4
- package/test/regression/TestZeroPriceFeed.t.sol +396 -0
|
@@ -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";
|
|
@@ -31,7 +38,6 @@ import {JB721TiersHookStore} from "@bananapus/721-hook-v6/src/JB721TiersHookStor
|
|
|
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";
|
|
33
40
|
import {REVEmpty721Config} from "./helpers/REVEmpty721Config.sol";
|
|
34
|
-
import {REVCroptopAllowedPost} from "../src/structs/REVCroptopAllowedPost.sol";
|
|
35
41
|
|
|
36
42
|
struct FeeProjectConfig {
|
|
37
43
|
REVConfig configuration;
|
|
@@ -40,24 +46,40 @@ struct FeeProjectConfig {
|
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
49
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
43
50
|
bytes32 REV_DEPLOYER_SALT = "REVDeployer";
|
|
51
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
44
52
|
bytes32 ERC20_SALT = "REV_TOKEN";
|
|
45
53
|
|
|
54
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
46
55
|
REVDeployer REV_DEPLOYER;
|
|
56
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
47
57
|
JB721TiersHook EXAMPLE_HOOK;
|
|
58
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
48
59
|
IJB721TiersHookDeployer HOOK_DEPLOYER;
|
|
60
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
49
61
|
IJB721TiersHookStore HOOK_STORE;
|
|
62
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
50
63
|
IJBAddressRegistry ADDRESS_REGISTRY;
|
|
64
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
51
65
|
IREVLoans LOANS_CONTRACT;
|
|
66
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
52
67
|
MockERC20 TOKEN;
|
|
68
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
53
69
|
IJBSuckerRegistry SUCKER_REGISTRY;
|
|
70
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
54
71
|
CTPublisher PUBLISHER;
|
|
72
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
55
73
|
MockBuybackDataHook MOCK_BUYBACK;
|
|
56
74
|
|
|
75
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
57
76
|
uint256 FEE_PROJECT_ID;
|
|
77
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
58
78
|
uint256 REVNET_ID;
|
|
59
79
|
|
|
80
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
60
81
|
address USER = makeAddr("user");
|
|
82
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
61
83
|
address RANDOM_CALLER = makeAddr("randomCaller");
|
|
62
84
|
|
|
63
85
|
address private constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
@@ -90,6 +112,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
90
112
|
autoIssuances: issuanceConfs,
|
|
91
113
|
splitPercent: 2000,
|
|
92
114
|
splits: splits,
|
|
115
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
93
116
|
initialIssuance: uint112(1000 * decimalMultiplier),
|
|
94
117
|
issuanceCutFrequency: 90 days,
|
|
95
118
|
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
@@ -99,6 +122,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
99
122
|
}
|
|
100
123
|
|
|
101
124
|
REVConfig memory revnetConfiguration = REVConfig({
|
|
125
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
102
126
|
description: REVDescription(name, symbol, projectUri, ERC20_SALT),
|
|
103
127
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
104
128
|
splitOperator: multisig(),
|
|
@@ -142,6 +166,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
142
166
|
autoIssuances: issuanceConfs,
|
|
143
167
|
splitPercent: 2000,
|
|
144
168
|
splits: splits,
|
|
169
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
145
170
|
initialIssuance: uint112(1000 * decimalMultiplier),
|
|
146
171
|
issuanceCutFrequency: 90 days,
|
|
147
172
|
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
@@ -154,6 +179,7 @@ contract TestCashOutCallerValidation is TestBaseWorkflow {
|
|
|
154
179
|
loanSources[0] = REVLoanSource({token: JBConstants.NATIVE_TOKEN, terminal: jbMultiTerminal()});
|
|
155
180
|
|
|
156
181
|
REVConfig memory revnetConfiguration = REVConfig({
|
|
182
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
157
183
|
description: REVDescription(name, symbol, projectUri, "NANA_TOKEN"),
|
|
158
184
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
159
185
|
splitOperator: multisig(),
|
|
@@ -1,28 +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";
|
|
10
14
|
import {REVEmpty721Config} from "./helpers/REVEmpty721Config.sol";
|
|
11
|
-
import {REVCroptopAllowedPost} from "../src/structs/REVCroptopAllowedPost.sol";
|
|
12
15
|
|
|
16
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
13
17
|
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
18
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
14
19
|
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
20
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
15
21
|
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
22
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
16
23
|
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
24
|
+
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
17
25
|
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
18
26
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
19
27
|
import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
20
|
-
import {MockPriceFeed} from "@bananapus/core-v6/test/mock/MockPriceFeed.sol";
|
|
21
28
|
import {MockERC20} from "@bananapus/core-v6/test/mock/MockERC20.sol";
|
|
22
29
|
import {REVLoans} from "../src/REVLoans.sol";
|
|
23
|
-
import {REVLoan} from "../src/structs/REVLoan.sol";
|
|
24
30
|
import {REVStageConfig, REVAutoIssuance} from "../src/structs/REVStageConfig.sol";
|
|
25
|
-
import {REVLoanSource} from "../src/structs/REVLoanSource.sol";
|
|
26
31
|
import {REVDescription} from "../src/structs/REVDescription.sol";
|
|
27
32
|
import {IREVLoans} from "./../src/interfaces/IREVLoans.sol";
|
|
28
33
|
import {JBSuckerDeployerConfig} from "@bananapus/suckers-v6/src/structs/JBSuckerDeployerConfig.sol";
|
|
@@ -34,22 +39,36 @@ import {JBAddressRegistry} from "@bananapus/address-registry-v6/src/JBAddressReg
|
|
|
34
39
|
import {IJBAddressRegistry} from "@bananapus/address-registry-v6/src/interfaces/IJBAddressRegistry.sol";
|
|
35
40
|
|
|
36
41
|
contract TestConversionDocumentation is TestBaseWorkflow {
|
|
42
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
37
43
|
bytes32 REV_DEPLOYER_SALT = "REVDeployer";
|
|
44
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
38
45
|
bytes32 ERC20_SALT = "REV_TOKEN";
|
|
39
46
|
|
|
47
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
40
48
|
REVDeployer REV_DEPLOYER;
|
|
49
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
41
50
|
JB721TiersHook EXAMPLE_HOOK;
|
|
51
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
42
52
|
IJB721TiersHookDeployer HOOK_DEPLOYER;
|
|
53
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
43
54
|
IJB721TiersHookStore HOOK_STORE;
|
|
55
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
44
56
|
IJBAddressRegistry ADDRESS_REGISTRY;
|
|
57
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
45
58
|
IREVLoans LOANS_CONTRACT;
|
|
59
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
46
60
|
MockERC20 TOKEN;
|
|
61
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
47
62
|
IJBSuckerRegistry SUCKER_REGISTRY;
|
|
63
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
48
64
|
CTPublisher PUBLISHER;
|
|
65
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
49
66
|
MockBuybackDataHook MOCK_BUYBACK;
|
|
50
67
|
|
|
68
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
51
69
|
uint256 FEE_PROJECT_ID;
|
|
52
70
|
|
|
71
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
53
72
|
address USER = makeAddr("user");
|
|
54
73
|
|
|
55
74
|
address private constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
@@ -89,6 +108,7 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
89
108
|
autoIssuances: new REVAutoIssuance[](0),
|
|
90
109
|
splitPercent: 2000,
|
|
91
110
|
splits: splits,
|
|
111
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
92
112
|
initialIssuance: uint112(1000 * decimalMultiplier),
|
|
93
113
|
issuanceCutFrequency: 90 days,
|
|
94
114
|
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
@@ -97,6 +117,7 @@ contract TestConversionDocumentation is TestBaseWorkflow {
|
|
|
97
117
|
});
|
|
98
118
|
|
|
99
119
|
configuration = REVConfig({
|
|
120
|
+
// forge-lint: disable-next-line(named-struct-fields)
|
|
100
121
|
description: REVDescription(name, symbol, "ipfs://test", salt),
|
|
101
122
|
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
102
123
|
splitOperator: multisig(),
|