@bannynet/core-v6 0.0.7 → 0.0.9
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/STYLE_GUIDE.md +15 -2
- package/package.json +9 -9
- package/script/Add.Denver.s.sol +8 -7
- package/script/Deploy.s.sol +84 -77
- package/script/Drop1.s.sol +8 -7
- package/script/helpers/BannyverseDeploymentLib.sol +14 -7
- package/script/helpers/MigrationHelper.sol +21 -18
- package/src/Banny721TokenUriResolver.sol +6 -1
- package/test/Banny721TokenUriResolver.t.sol +12 -10
- package/test/BannyAttacks.t.sol +2 -0
- package/test/DecorateFlow.t.sol +2 -0
- package/test/Fork.t.sol +14 -13
- package/test/regression/BodyCategoryValidation.t.sol +1 -0
- package/test/regression/BurnedTokenCheck.t.sol +1 -0
- package/test/regression/CEIReorder.t.sol +1 -0
- package/test/regression/MsgSenderEvents.t.sol +1 -0
- package/test/regression/RemovedTierDesync.t.sol +1 -0
package/STYLE_GUIDE.md
CHANGED
|
@@ -197,7 +197,7 @@ interface IJBExample is IJBBase {
|
|
|
197
197
|
| Public/external function | `camelCase` | `cashOutTokensOf` |
|
|
198
198
|
| Internal/private function | `_camelCase` | `_processFee` |
|
|
199
199
|
| Internal storage | `_camelCase` | `_accountingContextForTokenOf` |
|
|
200
|
-
| Function parameter | `camelCase` | `projectId`, `cashOutCount` |
|
|
200
|
+
| Function parameter | `camelCase` (no underscores) | `projectId`, `cashOutCount` |
|
|
201
201
|
|
|
202
202
|
## NatSpec
|
|
203
203
|
|
|
@@ -253,9 +253,12 @@ uint256 public constant MAX_RESERVED_PERCENT = 10_000;
|
|
|
253
253
|
|
|
254
254
|
## Function Calls
|
|
255
255
|
|
|
256
|
-
Use named
|
|
256
|
+
Use named arguments for all function calls with 2 or more arguments — in both `src/` and `script/`:
|
|
257
257
|
|
|
258
258
|
```solidity
|
|
259
|
+
// Good — named arguments
|
|
260
|
+
token.mint({account: beneficiary, amount: count});
|
|
261
|
+
_transferOwnership({newOwner: address(0), projectId: 0});
|
|
259
262
|
PERMISSIONS.hasPermission({
|
|
260
263
|
operator: sender,
|
|
261
264
|
account: account,
|
|
@@ -264,8 +267,18 @@ PERMISSIONS.hasPermission({
|
|
|
264
267
|
includeRoot: true,
|
|
265
268
|
includeWildcardProjectId: true
|
|
266
269
|
});
|
|
270
|
+
|
|
271
|
+
// Bad — positional arguments with 2+ args
|
|
272
|
+
token.mint(beneficiary, count);
|
|
273
|
+
_transferOwnership(address(0), 0);
|
|
267
274
|
```
|
|
268
275
|
|
|
276
|
+
Single-argument calls use positional style: `_burn(amount)`.
|
|
277
|
+
|
|
278
|
+
This also applies to constructor calls, struct literals, and inherited/library calls (e.g., OZ `_mint`, `_safeMint`, `safeTransfer`, `allowance`, `Clones.cloneDeterministic`).
|
|
279
|
+
|
|
280
|
+
Named argument keys must use **camelCase** — never underscores. If a function's parameter names use underscores, rename them to camelCase first.
|
|
281
|
+
|
|
269
282
|
## Multiline Signatures
|
|
270
283
|
|
|
271
284
|
```solidity
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bannynet/core-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'banny-core-v6'"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@bananapus/721-hook-v6": "^0.0.
|
|
24
|
-
"@bananapus/core-v6": "^0.0.
|
|
25
|
-
"@bananapus/permission-ids-v6": "^0.0.
|
|
26
|
-
"@bananapus/router-terminal-v6": "^0.0.
|
|
27
|
-
"@bananapus/suckers-v6": "^0.0.
|
|
28
|
-
"@croptop/core-v6": "^0.0.
|
|
23
|
+
"@bananapus/721-hook-v6": "^0.0.16",
|
|
24
|
+
"@bananapus/core-v6": "^0.0.16",
|
|
25
|
+
"@bananapus/permission-ids-v6": "^0.0.9",
|
|
26
|
+
"@bananapus/router-terminal-v6": "^0.0.11",
|
|
27
|
+
"@bananapus/suckers-v6": "^0.0.10",
|
|
28
|
+
"@croptop/core-v6": "^0.0.15",
|
|
29
29
|
"@openzeppelin/contracts": "^5.6.1",
|
|
30
|
-
"@rev-net/core-v6": "^0.0.
|
|
30
|
+
"@rev-net/core-v6": "^0.0.12",
|
|
31
31
|
"keccak": "^3.0.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@sphinx-labs/plugins": "^0.33.2"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|
package/script/Add.Denver.s.sol
CHANGED
|
@@ -5,10 +5,11 @@ import {JB721TierConfig} from "@bananapus/721-hook-v6/src/structs/JB721TierConfi
|
|
|
5
5
|
import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
6
6
|
import {JB721TiersHook} from "@bananapus/721-hook-v6/src/JB721TiersHook.sol";
|
|
7
7
|
|
|
8
|
-
import "./helpers/BannyverseDeploymentLib.sol";
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import {BannyverseDeployment, BannyverseDeploymentLib} from "./helpers/BannyverseDeploymentLib.sol";
|
|
9
|
+
import {
|
|
10
|
+
RevnetCoreDeployment,
|
|
11
|
+
RevnetCoreDeploymentLib
|
|
12
|
+
} from "@rev-net/core-v6/script/helpers/RevnetCoreDeploymentLib.sol";
|
|
12
13
|
import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
|
|
13
14
|
import {Script} from "forge-std/Script.sol";
|
|
14
15
|
|
|
@@ -78,13 +79,13 @@ contract Drop1Script is Script, Sphinx {
|
|
|
78
79
|
// Get the next tier ID so we can set names and hashes for the new product.
|
|
79
80
|
uint256 nextTierId = hook.STORE().maxTierIdOf(address(hook)) + 1;
|
|
80
81
|
|
|
81
|
-
hook.adjustTiers(products, new uint256[](0));
|
|
82
|
+
hook.adjustTiers({tiersToAdd: products, tierIdsToRemove: new uint256[](0)});
|
|
82
83
|
|
|
83
84
|
// Build the product IDs array for the newly added tier(s).
|
|
84
85
|
uint256[] memory productIds = new uint256[](1);
|
|
85
86
|
productIds[0] = nextTierId;
|
|
86
87
|
|
|
87
|
-
bannyverse.resolver.setSvgHashesOf(productIds, svgHashes);
|
|
88
|
-
bannyverse.resolver.setProductNames(productIds, names);
|
|
88
|
+
bannyverse.resolver.setSvgHashesOf({upcs: productIds, svgHashes: svgHashes});
|
|
89
|
+
bannyverse.resolver.setProductNames({upcs: productIds, names: names});
|
|
89
90
|
}
|
|
90
91
|
}
|
package/script/Deploy.s.sol
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
5
|
-
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
6
|
-
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
7
|
-
import
|
|
8
|
-
|
|
4
|
+
import {Hook721Deployment, Hook721DeploymentLib} from "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
5
|
+
import {CoreDeployment, CoreDeploymentLib} from "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
6
|
+
import {SuckerDeployment, SuckerDeploymentLib} from "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
7
|
+
import {
|
|
8
|
+
RouterTerminalDeployment,
|
|
9
|
+
RouterTerminalDeploymentLib
|
|
10
|
+
} from "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
11
|
+
import {
|
|
12
|
+
RevnetCoreDeployment,
|
|
13
|
+
RevnetCoreDeploymentLib
|
|
14
|
+
} from "@rev-net/core-v6/script/helpers/RevnetCoreDeploymentLib.sol";
|
|
9
15
|
|
|
10
16
|
import {IJB721TokenUriResolver} from "@bananapus/721-hook-v6/src/interfaces/IJB721TokenUriResolver.sol";
|
|
11
17
|
import {JB721InitTiersConfig} from "@bananapus/721-hook-v6/src/structs/JB721InitTiersConfig.sol";
|
|
12
18
|
import {JB721TierConfig} from "@bananapus/721-hook-v6/src/structs/JB721TierConfig.sol";
|
|
13
|
-
import {REVBaseline721HookConfig} from "@rev-net/core-v6/src/structs/REVBaseline721HookConfig.sol";
|
|
14
|
-
import {REV721TiersHookFlags} from "@rev-net/core-v6/src/structs/REV721TiersHookFlags.sol";
|
|
15
|
-
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
16
19
|
import {IJBSplitHook} from "@bananapus/core-v6/src/interfaces/IJBSplitHook.sol";
|
|
17
20
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
18
21
|
import {JBCurrencyIds} from "@bananapus/core-v6/src/libraries/JBCurrencyIds.sol";
|
|
@@ -23,8 +26,10 @@ import {JBTokenMapping} from "@bananapus/suckers-v6/src/structs/JBTokenMapping.s
|
|
|
23
26
|
import {REVAutoIssuance} from "@rev-net/core-v6/src/structs/REVAutoIssuance.sol";
|
|
24
27
|
import {REVConfig} from "@rev-net/core-v6/src/structs/REVConfig.sol";
|
|
25
28
|
import {REVCroptopAllowedPost} from "@rev-net/core-v6/src/structs/REVCroptopAllowedPost.sol";
|
|
29
|
+
import {REVBaseline721HookConfig} from "@rev-net/core-v6/src/structs/REVBaseline721HookConfig.sol";
|
|
26
30
|
import {REVDeploy721TiersHookConfig} from "@rev-net/core-v6/src/structs/REVDeploy721TiersHookConfig.sol";
|
|
27
31
|
import {REVDescription} from "@rev-net/core-v6/src/structs/REVDescription.sol";
|
|
32
|
+
import {REV721TiersHookFlags} from "@rev-net/core-v6/src/structs/REV721TiersHookFlags.sol";
|
|
28
33
|
import {REVStageConfig} from "@rev-net/core-v6/src/structs/REVStageConfig.sol";
|
|
29
34
|
import {REVSuckerDeploymentConfig} from "@rev-net/core-v6/src/structs/REVSuckerDeploymentConfig.sol";
|
|
30
35
|
import {JBSuckerDeployerConfig} from "@bananapus/suckers-v6/src/structs/JBSuckerDeployerConfig.sol";
|
|
@@ -56,27 +61,29 @@ contract DeployScript is Script, Sphinx {
|
|
|
56
61
|
|
|
57
62
|
BannyverseRevnetConfig bannyverseConfig;
|
|
58
63
|
|
|
59
|
-
uint32 PREMINT_CHAIN_ID = 1;
|
|
60
|
-
bytes32 ERC20_SALT = "_BAN_ERC20V6_";
|
|
61
|
-
bytes32 SUCKER_SALT = "_BAN_SUCKERV6_";
|
|
62
|
-
bytes32 HOOK_SALT = "_BAN_HOOKV6_";
|
|
63
|
-
bytes32 RESOLVER_SALT = "_BAN_RESOLVERV6_";
|
|
64
|
-
string NAME = "Banny Network";
|
|
65
|
-
string SYMBOL = "BAN";
|
|
66
|
-
string PROJECT_URI = "ipfs://Qme34ww9HuwnsWF6sYDpDfpSdYHpPCGsEyJULk1BikCVYp";
|
|
67
|
-
string BASE_URI = "ipfs://";
|
|
68
|
-
uint32 NATIVE_CURRENCY = uint32(uint160(JBConstants.NATIVE_TOKEN));
|
|
69
|
-
uint32 ETH_CURRENCY = JBCurrencyIds.ETH;
|
|
70
|
-
uint8 DECIMALS = 18;
|
|
71
|
-
uint256 DECIMAL_MULTIPLIER = 10 ** DECIMALS;
|
|
72
|
-
uint24 BANNY_BODY_CATEGORY = 0;
|
|
73
|
-
address
|
|
74
|
-
address
|
|
75
|
-
uint48 BAN_START_TIME = 1_740_435_044;
|
|
76
|
-
uint104
|
|
77
|
-
uint104
|
|
78
|
-
uint104
|
|
79
|
-
uint104
|
|
64
|
+
uint32 constant PREMINT_CHAIN_ID = 1;
|
|
65
|
+
bytes32 constant ERC20_SALT = "_BAN_ERC20V6_";
|
|
66
|
+
bytes32 constant SUCKER_SALT = "_BAN_SUCKERV6_";
|
|
67
|
+
bytes32 constant HOOK_SALT = "_BAN_HOOKV6_";
|
|
68
|
+
bytes32 constant RESOLVER_SALT = "_BAN_RESOLVERV6_";
|
|
69
|
+
string constant NAME = "Banny Network";
|
|
70
|
+
string constant SYMBOL = "BAN";
|
|
71
|
+
string constant PROJECT_URI = "ipfs://Qme34ww9HuwnsWF6sYDpDfpSdYHpPCGsEyJULk1BikCVYp";
|
|
72
|
+
string constant BASE_URI = "ipfs://";
|
|
73
|
+
uint32 constant NATIVE_CURRENCY = uint32(uint160(JBConstants.NATIVE_TOKEN));
|
|
74
|
+
uint32 constant ETH_CURRENCY = JBCurrencyIds.ETH;
|
|
75
|
+
uint8 constant DECIMALS = 18;
|
|
76
|
+
uint256 constant DECIMAL_MULTIPLIER = 10 ** DECIMALS;
|
|
77
|
+
uint24 constant BANNY_BODY_CATEGORY = 0;
|
|
78
|
+
address operator;
|
|
79
|
+
address trustedForwarder;
|
|
80
|
+
uint48 constant BAN_START_TIME = 1_740_435_044;
|
|
81
|
+
uint104 constant BAN_MAINNET_AUTO_ISSUANCE = 545_296_034_092_246_678_345_976;
|
|
82
|
+
uint104 constant BAN_BASE_AUTO_ISSUANCE = 10_097_684_379_816_492_953_872;
|
|
83
|
+
uint104 constant BAN_OP_AUTO_ISSUANCE = 328_366_065_858_064_488_000;
|
|
84
|
+
uint104 constant BAN_ARB_AUTO_ISSUANCE = 2_825_980_000_000_000_000_000;
|
|
85
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
86
|
+
uint104 constant BAN_PREMINT_COUNT = uint104(1_000_000 * DECIMAL_MULTIPLIER);
|
|
80
87
|
|
|
81
88
|
function configureSphinx() public override {
|
|
82
89
|
sphinxConfig.projectName = "banny-core-v6";
|
|
@@ -86,7 +93,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
86
93
|
|
|
87
94
|
function run() public {
|
|
88
95
|
// Get the operator address.
|
|
89
|
-
|
|
96
|
+
operator = safeAddress();
|
|
90
97
|
|
|
91
98
|
// Get the deployment addresses for the nana CORE for this chain.
|
|
92
99
|
// We want to do this outside of the `sphinx` modifier.
|
|
@@ -113,7 +120,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
113
120
|
)
|
|
114
121
|
);
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
trustedForwarder = core.controller.trustedForwarder();
|
|
117
124
|
|
|
118
125
|
bannyverseConfig = getBannyverseRevnetConfig();
|
|
119
126
|
|
|
@@ -142,7 +149,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
142
149
|
splits[0] = JBSplit({
|
|
143
150
|
percent: JBConstants.SPLITS_TOTAL_PERCENT,
|
|
144
151
|
projectId: 0,
|
|
145
|
-
beneficiary: payable(
|
|
152
|
+
beneficiary: payable(operator),
|
|
146
153
|
preferAddToBalance: false,
|
|
147
154
|
lockedUntil: 0,
|
|
148
155
|
hook: IJBSplitHook(address(0))
|
|
@@ -153,16 +160,17 @@ contract DeployScript is Script, Sphinx {
|
|
|
153
160
|
|
|
154
161
|
{
|
|
155
162
|
REVAutoIssuance[] memory autoIssuances = new REVAutoIssuance[](4);
|
|
156
|
-
autoIssuances[0] = REVAutoIssuance({chainId: 1, count:
|
|
157
|
-
autoIssuances[1] = REVAutoIssuance({chainId: 8453, count:
|
|
158
|
-
autoIssuances[2] = REVAutoIssuance({chainId: 10, count:
|
|
159
|
-
autoIssuances[3] = REVAutoIssuance({chainId: 42_161, count:
|
|
163
|
+
autoIssuances[0] = REVAutoIssuance({chainId: 1, count: BAN_MAINNET_AUTO_ISSUANCE, beneficiary: operator});
|
|
164
|
+
autoIssuances[1] = REVAutoIssuance({chainId: 8453, count: BAN_BASE_AUTO_ISSUANCE, beneficiary: operator});
|
|
165
|
+
autoIssuances[2] = REVAutoIssuance({chainId: 10, count: BAN_OP_AUTO_ISSUANCE, beneficiary: operator});
|
|
166
|
+
autoIssuances[3] = REVAutoIssuance({chainId: 42_161, count: BAN_ARB_AUTO_ISSUANCE, beneficiary: operator});
|
|
160
167
|
|
|
161
168
|
stageConfigurations[0] = REVStageConfig({
|
|
162
169
|
startsAtOrAfter: BAN_START_TIME,
|
|
163
170
|
autoIssuances: autoIssuances,
|
|
164
171
|
splitPercent: 3800, // 38%
|
|
165
172
|
splits: splits,
|
|
173
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
166
174
|
initialIssuance: uint112(10_000 * DECIMAL_MULTIPLIER),
|
|
167
175
|
issuanceCutFrequency: 60 days,
|
|
168
176
|
issuanceCutPercent: 380_000_000, // 38%,
|
|
@@ -173,9 +181,8 @@ contract DeployScript is Script, Sphinx {
|
|
|
173
181
|
|
|
174
182
|
{
|
|
175
183
|
REVAutoIssuance[] memory autoIssuances = new REVAutoIssuance[](1);
|
|
176
|
-
autoIssuances[0] =
|
|
177
|
-
chainId: PREMINT_CHAIN_ID, count:
|
|
178
|
-
});
|
|
184
|
+
autoIssuances[0] =
|
|
185
|
+
REVAutoIssuance({chainId: PREMINT_CHAIN_ID, count: BAN_PREMINT_COUNT, beneficiary: operator});
|
|
179
186
|
|
|
180
187
|
// decrease by a smaller percent more frequently. 30 days, 7%-ish.
|
|
181
188
|
stageConfigurations[1] = REVStageConfig({
|
|
@@ -204,9 +211,9 @@ contract DeployScript is Script, Sphinx {
|
|
|
204
211
|
});
|
|
205
212
|
|
|
206
213
|
REVConfig memory revnetConfiguration = REVConfig({
|
|
207
|
-
description: REVDescription(NAME, SYMBOL, PROJECT_URI, ERC20_SALT),
|
|
214
|
+
description: REVDescription({name: NAME, ticker: SYMBOL, uri: PROJECT_URI, salt: ERC20_SALT}),
|
|
208
215
|
baseCurrency: ETH_CURRENCY,
|
|
209
|
-
splitOperator:
|
|
216
|
+
splitOperator: operator,
|
|
210
217
|
stageConfigurations: stageConfigurations
|
|
211
218
|
});
|
|
212
219
|
|
|
@@ -219,7 +226,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
219
226
|
votingUnits: 0,
|
|
220
227
|
reserveFrequency: 0,
|
|
221
228
|
reserveBeneficiary: address(0),
|
|
222
|
-
encodedIPFSUri: bytes32(
|
|
229
|
+
encodedIPFSUri: bytes32(0),
|
|
223
230
|
category: BANNY_BODY_CATEGORY,
|
|
224
231
|
discountPercent: 0,
|
|
225
232
|
cannotIncreaseDiscountPercent: true,
|
|
@@ -237,7 +244,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
237
244
|
votingUnits: 0,
|
|
238
245
|
reserveFrequency: 0,
|
|
239
246
|
reserveBeneficiary: address(0),
|
|
240
|
-
encodedIPFSUri: bytes32(
|
|
247
|
+
encodedIPFSUri: bytes32(0),
|
|
241
248
|
category: BANNY_BODY_CATEGORY,
|
|
242
249
|
discountPercent: 0,
|
|
243
250
|
cannotIncreaseDiscountPercent: true,
|
|
@@ -255,7 +262,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
255
262
|
votingUnits: 0,
|
|
256
263
|
reserveFrequency: 0,
|
|
257
264
|
reserveBeneficiary: address(0),
|
|
258
|
-
encodedIPFSUri: bytes32(
|
|
265
|
+
encodedIPFSUri: bytes32(0),
|
|
259
266
|
category: BANNY_BODY_CATEGORY,
|
|
260
267
|
discountPercent: 0,
|
|
261
268
|
cannotIncreaseDiscountPercent: true,
|
|
@@ -273,7 +280,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
273
280
|
votingUnits: 0,
|
|
274
281
|
reserveFrequency: 0,
|
|
275
282
|
reserveBeneficiary: address(0),
|
|
276
|
-
encodedIPFSUri: bytes32(
|
|
283
|
+
encodedIPFSUri: bytes32(0),
|
|
277
284
|
category: BANNY_BODY_CATEGORY,
|
|
278
285
|
discountPercent: 0,
|
|
279
286
|
cannotIncreaseDiscountPercent: true,
|
|
@@ -338,9 +345,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
338
345
|
tokenUriResolver: IJB721TokenUriResolver(address(0)), // This will be replaced once we know the
|
|
339
346
|
// address.
|
|
340
347
|
contractUri: "https://jbm.infura-ipfs.io/ipfs/Qmd2hgb1E4caEB51VvoC3GvonhwkCoVyXjJ3zqsCxHPTKK",
|
|
341
|
-
tiersConfig: JB721InitTiersConfig({
|
|
342
|
-
tiers: tiers, currency: ETH_CURRENCY, decimals: DECIMALS, prices: core.prices
|
|
343
|
-
}),
|
|
348
|
+
tiersConfig: JB721InitTiersConfig({tiers: tiers, currency: ETH_CURRENCY, decimals: DECIMALS}),
|
|
344
349
|
reserveBeneficiary: address(0),
|
|
345
350
|
flags: REV721TiersHookFlags({
|
|
346
351
|
noNewTiersWithReserves: false,
|
|
@@ -350,10 +355,10 @@ contract DeployScript is Script, Sphinx {
|
|
|
350
355
|
})
|
|
351
356
|
}),
|
|
352
357
|
salt: HOOK_SALT,
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
358
|
+
preventSplitOperatorAdjustingTiers: false,
|
|
359
|
+
preventSplitOperatorUpdatingMetadata: false,
|
|
360
|
+
preventSplitOperatorMinting: false,
|
|
361
|
+
preventSplitOperatorIncreasingDiscountPercent: false
|
|
357
362
|
})
|
|
358
363
|
});
|
|
359
364
|
}
|
|
@@ -362,15 +367,15 @@ contract DeployScript is Script, Sphinx {
|
|
|
362
367
|
// Deploy the Banny URI Resolver.
|
|
363
368
|
Banny721TokenUriResolver resolver;
|
|
364
369
|
|
|
365
|
-
string memory
|
|
370
|
+
string memory bannyBodySvg =
|
|
366
371
|
'<g class="a1"><path d="M173 53h4v17h-4z"/></g><g class="a2"><path d="M167 57h3v10h-3z"/><path d="M169 53h4v17h-4z"/></g><g class="a3"><path d="M167 53h3v4h-3z"/><path d="M163 57h4v10h-4z"/><path d="M167 67h3v3h-3z"/></g><g class="b1"><path d="M213 253h-3v-3-3h-3v-7-3h-4v-10h-3v-7-7-3h-3v-73h-4v-10h-3v-10h-3v-7h-4v-7h-3v-3h-3v-3h-4v10h4v10h3v10h3v3h4v7 3 70 3h3v7h3v20h4v7h3v3h3v3h4v4h3v3h3v-3-4z"/><path d="M253 307v-4h-3v-3h-3v-3h-4v-4h-3v-3h-3v-3h-4v-4h-3v-3h-3v-3h-4v-4h-3v-6h-3v-7h-4v17h4v3h3v3h3 4v4h3v3h3v3h4v4h3v3h3v3h4v4h3v3h3v3h4v-6h-4z"/></g><g class="b2"><path d="M250 310v-3h-3v-4h-4v-3h-3v-3h-3v-4h-4v-3h-3v-3h-3v-4h-7v-3h-3v-3h-4v-17h-3v-3h-3v-4h-4v-3h-3v-3h-3v-7h-4v-20h-3v-7h-3v-73-3-7h-4v-3h-3v-10h-3v-10h-4V70h-3v-3l-3 100 3-100v40h-3v10h-4v6h-3v14h-3v3 13h-4v44h4v16h3v14h3v13h4v10h3v7h3v3h4v3h3v4h3v3h4v3h3v4h3v3h4v3h3v7h7v7h6v3h7v3h7v4h13v3h3v3h10v-3h-3zm-103-87v-16h3v-10h-3v6h-4v17h-3v10h3v-7h4z"/><path d="M143 230h4v7h-4zm4 10h3v3h-3zm3 7h3v3h-3zm3 6h4v4h-4z"/><path d="M163 257h-6v3h3v3h3v4h4v-4-3h-4v-3z"/></g><g class="b3"><path d="M143 197v6h4v-6h6v-44h4v-16h3v-14h3v-6h4v-10h3V97h-7v6h-3v4h-3v3h-4v3h-3v4 3h-3v3 4h-4v10h-3v16 4h-3v46h3v-6h3z"/><path d="M140 203h3v17h-3z"/><path d="M137 220h3v10h-3z"/><path d="M153 250h-3v-7h-3v-6h-4v-7h-3v10h3v7h4v6h3v4h3v-7zm-3 10h3v7h-3z"/><path d="M147 257h3v3h-3zm6 0h4v3h-4z"/><path d="M160 263v-3h-3v3 7h6v-7h-3zm-10-56v16h-3v7h3v10h3v7h4v6h6v4h7v-4-3h-3v-10h-4v-13h-3v-14h-3v-16h-4v10h-3z"/><path d="M243 313v-3h-3v-3h-10-3v-4h-7v-3h-7v-3h-6v-7h-7v-7h-3v-3h-4v-3h-3v-4h-3v-3h-4v-3h-3v-4h-3v-3h-4v-3h-3v10h-3v3h-4v3h-3v7h3v7h4v6h3v5h4v3h6v3h3v3h4 3v3h3 4v3h3 3v4h10v3h7 7 3v3h10 3v-3h10v-3h4v-4h-14z"/></g><g class="b4"><path d="M183 130h4v7h-4z"/><path d="M180 127h3v3h-3zm-27-4h4v7h-4z"/><path d="M157 117h3v6h-3z"/><path d="M160 110h3v7h-3z"/><path d="M163 107h4v3h-4zm-3 83h3v7h-3z"/><path d="M163 187h4v3h-4zm20 0h7v3h-7z"/><path d="M180 190h3v3h-3zm10-7h3v4h-3z"/><path d="M193 187h4v6h-4zm-20 53h4v7h-4z"/><path d="M177 247h3v6h-3z"/><path d="M180 253h3v7h-3z"/><path d="M183 260h7v3h-7z"/><path d="M190 263h3v4h-3zm0-20h3v4h-3z"/><path d="M187 240h3v3h-3z"/><path d="M190 237h3v3h-3zm13 23h4v3h-4z"/><path d="M207 263h3v7h-3z"/><path d="M210 270h3v3h-3zm-10 7h3v6h-3z"/><path d="M203 283h4v7h-4z"/><path d="M207 290h6v3h-6z"/></g><g class="o"><path d="M133 157h4v50h-4zm0 63h4v10h-4zm27-163h3v10h-3z"/><path d="M163 53h4v4h-4z"/><path d="M167 50h10v3h-10z"/><path d="M177 53h3v17h-3z"/><path d="M173 70h4v27h-4zm-6 0h3v27h-3z"/><path d="M163 67h4v3h-4zm0 30h4v3h-4z"/><path d="M160 100h3v3h-3z"/><path d="M157 103h3v4h-3z"/><path d="M153 107h4v3h-4z"/><path d="M150 110h3v3h-3z"/><path d="M147 113h3v7h-3z"/><path d="M143 120h4v7h-4z"/><path d="M140 127h3v10h-3z"/><path d="M137 137h3v20h-3zm56-10h4v10h-4z"/><path d="M190 117h3v10h-3z"/><path d="M187 110h3v7h-3z"/><path d="M183 103h4v7h-4z"/><path d="M180 100h3v3h-3z"/><path d="M177 97h3v3h-3zm-40 106h3v17h-3zm0 27h3v10h-3zm10 30h3v7h-3z"/><path d="M150 257v-4h-3v-6h-4v-7h-3v10h3v10h4v-3h3z"/><path d="M150 257h3v3h-3z"/><path d="M163 273v-3h-6v-10h-4v7h-3v3h3v3h4v7h3v-7h3z"/><path d="M163 267h4v3h-4z"/><path d="M170 257h-3-4v3h4v7h3v-10z"/><path d="M157 253h6v4h-6z"/><path d="M153 247h4v6h-4z"/><path d="M150 240h3v7h-3z"/><path d="M147 230h3v10h-3zm13 50h3v7h-3z"/><path d="M143 223h4v7h-4z"/><path d="M147 207h3v16h-3z"/><path d="M150 197h3v10h-3zm-10 0h3v6h-3zm50 113h7v3h-7zm23 10h17v3h-17z"/><path d="M230 323h13v4h-13z"/><path d="M243 320h10v3h-10z"/><path d="M253 317h4v3h-4z"/><path d="M257 307h3v10h-3z"/><path d="M253 303h4v4h-4z"/><path d="M250 300h3v3h-3z"/><path d="M247 297h3v3h-3z"/><path d="M243 293h4v4h-4z"/><path d="M240 290h3v3h-3z"/><path d="M237 287h3v3h-3z"/><path d="M233 283h4v4h-4z"/><path d="M230 280h3v3h-3z"/><path d="M227 277h3v3h-3z"/><path d="M223 273h4v4h-4z"/><path d="M220 267h3v6h-3z"/><path d="M217 260h3v7h-3z"/><path d="M213 253h4v7h-4z"/><path d="M210 247h3v6h-3z"/><path d="M207 237h3v10h-3z"/><path d="M203 227h4v10h-4zm-40 60h4v6h-4zm24 20h3v3h-3z"/><path d="M167 293h3v5h-3zm16 14h4v3h-4z"/><path d="M170 298h4v3h-4zm10 6h3v3h-3z"/><path d="M174 301h6v3h-6zm23 12h6v4h-6z"/><path d="M203 317h10v3h-10zm-2-107v-73h-4v73h3v17h3v-17h-2z"/></g><g class="o"><path d="M187 307v-4h3v-6h-3v-4h-4v-3h-3v-3h-7v-4h-6v4h-4v3h4v27h-4v13h-3v10h-4v7h4v3h3 10 14v-3h-4v-4h-3v-3h-3v-3h-4v-7h4v-10h3v-7h3v-3h7v-3h-3zm16 10v-4h-6v17h-4v10h-3v7h3v3h4 6 4 3 14v-3h-4v-4h-7v-3h-3v-3h-3v-10h3v-7h3v-3h-10z"/></g>';
|
|
367
|
-
string memory
|
|
372
|
+
string memory defaultNecklaceSvg =
|
|
368
373
|
'<g class="o"><path d="M190 173h-37v-3h-10v-4h-6v4h3v3h-3v4h6v3h10v4h37v-4h3v-3h-3v-4zm-40 4h-3v-4h3v4zm7 3v-3h3v3h-3zm6 0v-3h4v3h-4zm7 0v-3h3v3h-3zm7 0v-3h3v3h-3zm10 0h-4v-3h4v3z"/><path d="M190 170h3v3h-3z"/><path d="M193 166h4v4h-4zm0 7h4v4h-4z"/></g><g class="w"><path d="M137 170h3v3h-3zm10 3h3v4h-3zm10 4h3v3h-3zm6 0h4v3h-4zm7 0h3v3h-3zm7 0h3v3h-3zm6 0h4v3h-4zm7-4h3v4h-3z"/><path d="M193 170h4v3h-4z"/></g>';
|
|
369
|
-
string memory
|
|
374
|
+
string memory defaultMouthSvg =
|
|
370
375
|
'<g class="o"><path d="M183 160v-4h-20v4h-3v3h3v4h24v-7h-4zm-13 3v-3h10v3h-10z" fill="#ad71c8"/><path d="M170 160h10v3h-10z"/></g>';
|
|
371
|
-
string memory
|
|
376
|
+
string memory defaultStandardEyesSvg =
|
|
372
377
|
'<g class="o"><path d="M177 140v3h6v11h10v-11h4v-3h-20z"/><path d="M153 140v3h7v8 3h7 3v-11h3v-3h-20z"/></g><g class="w"><path d="M153 143h7v4h-7z"/><path d="M157 147h3v3h-3zm20-4h6v4h-6z"/><path d="M180 147h3v3h-3z"/></g>';
|
|
373
|
-
string memory
|
|
378
|
+
string memory defaultAlienEyesSvg =
|
|
374
379
|
'<g class="o"><path d="M190 127h3v3h-3zm3 13h4v3h-4zm-42 0h6v6h-6z"/><path d="M151 133h3v7h-3zm10 0h6v4h-6z"/><path d="M157 137h17v6h-17zm3 13h14v3h-14zm17-13h7v16h-7z"/><path d="M184 137h6v6h-6zm0 10h10v6h-10z"/><path d="M187 143h10v4h-10z"/><path d="M190 140h3v3h-3zm-6-10h3v7h-3z"/><path d="M187 130h6v3h-6zm-36 0h10v3h-10zm16 13h7v7h-7zm-10 0h7v7h-7z"/><path d="M164 147h3v3h-3zm29-20h4v6h-4z"/><path d="M194 133h3v7h-3z"/></g><g class="w"><path d="M154 133h7v4h-7z"/><path d="M154 137h3v3h-3zm10 6h3v4h-3zm20 0h3v4h-3zm3-10h7v4h-7z"/><path d="M190 137h4v3h-4z"/></g>';
|
|
375
380
|
{
|
|
376
381
|
// Perform the check for the resolver..
|
|
@@ -378,40 +383,42 @@ contract DeployScript is Script, Sphinx {
|
|
|
378
383
|
RESOLVER_SALT,
|
|
379
384
|
type(Banny721TokenUriResolver).creationCode,
|
|
380
385
|
abi.encode(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
bannyBodySvg,
|
|
387
|
+
defaultNecklaceSvg,
|
|
388
|
+
defaultMouthSvg,
|
|
389
|
+
defaultStandardEyesSvg,
|
|
390
|
+
defaultAlienEyesSvg,
|
|
391
|
+
operator,
|
|
392
|
+
trustedForwarder
|
|
388
393
|
)
|
|
389
394
|
);
|
|
390
395
|
// Deploy it if it has not been deployed yet.
|
|
391
396
|
resolver = !_resolverIsDeployed
|
|
392
|
-
? new Banny721TokenUriResolver{salt: RESOLVER_SALT}(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
)
|
|
397
|
+
? new Banny721TokenUriResolver{salt: RESOLVER_SALT}({
|
|
398
|
+
bannyBody: bannyBodySvg,
|
|
399
|
+
defaultNecklace: defaultNecklaceSvg,
|
|
400
|
+
defaultMouth: defaultMouthSvg,
|
|
401
|
+
defaultStandardEyes: defaultStandardEyesSvg,
|
|
402
|
+
defaultAlienEyes: defaultAlienEyesSvg,
|
|
403
|
+
owner: operator,
|
|
404
|
+
trustedForwarder: trustedForwarder
|
|
405
|
+
})
|
|
401
406
|
: Banny721TokenUriResolver(_resolver);
|
|
402
407
|
}
|
|
403
408
|
|
|
404
409
|
// Set the resolver's metadata.
|
|
405
|
-
resolver.setMetadata(
|
|
406
|
-
"A piece of Banny Retail.",
|
|
407
|
-
|
|
410
|
+
resolver.setMetadata({
|
|
411
|
+
description: "A piece of Banny Retail.",
|
|
412
|
+
url: "https://retail.banny.eth.shop",
|
|
413
|
+
baseUri: "https://bannyverse.infura-ipfs.io/ipfs/"
|
|
414
|
+
});
|
|
408
415
|
|
|
409
416
|
// Update our config with its address.
|
|
410
417
|
bannyverseConfig.hookConfiguration.baseline721HookConfiguration.tokenUriResolver = resolver;
|
|
411
418
|
|
|
412
419
|
// Deploy the $BANNY Revnet.
|
|
413
420
|
revnet.basic_deployer
|
|
414
|
-
.
|
|
421
|
+
.deployFor({
|
|
415
422
|
revnetId: 0,
|
|
416
423
|
configuration: bannyverseConfig.configuration,
|
|
417
424
|
terminalConfigurations: bannyverseConfig.terminalConfigurations,
|
package/script/Drop1.s.sol
CHANGED
|
@@ -5,10 +5,11 @@ import {JB721TierConfig} from "@bananapus/721-hook-v6/src/structs/JB721TierConfi
|
|
|
5
5
|
import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
6
6
|
import {JB721TiersHook} from "@bananapus/721-hook-v6/src/JB721TiersHook.sol";
|
|
7
7
|
|
|
8
|
-
import "./helpers/BannyverseDeploymentLib.sol";
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import {BannyverseDeployment, BannyverseDeploymentLib} from "./helpers/BannyverseDeploymentLib.sol";
|
|
9
|
+
import {
|
|
10
|
+
RevnetCoreDeployment,
|
|
11
|
+
RevnetCoreDeploymentLib
|
|
12
|
+
} from "@rev-net/core-v6/script/helpers/RevnetCoreDeploymentLib.sol";
|
|
12
13
|
import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
|
|
13
14
|
import {Script} from "forge-std/Script.sol";
|
|
14
15
|
|
|
@@ -1047,8 +1048,8 @@ contract Drop1Script is Script, Sphinx {
|
|
|
1047
1048
|
productIds[i] = i + 5;
|
|
1048
1049
|
}
|
|
1049
1050
|
|
|
1050
|
-
hook.adjustTiers(products, new uint256[](0));
|
|
1051
|
-
bannyverse.resolver.setSvgHashesOf(productIds, svgHashes);
|
|
1052
|
-
bannyverse.resolver.setProductNames(productIds, names);
|
|
1051
|
+
hook.adjustTiers({tiersToAdd: products, tierIdsToRemove: new uint256[](0)});
|
|
1052
|
+
bannyverse.resolver.setSvgHashesOf({upcs: productIds, svgHashes: svgHashes});
|
|
1053
|
+
bannyverse.resolver.setProductNames({upcs: productIds, names: names});
|
|
1053
1054
|
}
|
|
1054
1055
|
}
|
|
@@ -16,6 +16,7 @@ struct BannyverseDeployment {
|
|
|
16
16
|
library BannyverseDeploymentLib {
|
|
17
17
|
// Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.
|
|
18
18
|
address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code"))));
|
|
19
|
+
// forge-lint: disable-next-line(screaming-snake-case-const)
|
|
19
20
|
Vm internal constant vm = Vm(VM_ADDRESS);
|
|
20
21
|
|
|
21
22
|
function getDeployment(
|
|
@@ -35,7 +36,7 @@ library BannyverseDeploymentLib {
|
|
|
35
36
|
|
|
36
37
|
for (uint256 _i; _i < networks.length; _i++) {
|
|
37
38
|
if (networks[_i].chainId == chainId) {
|
|
38
|
-
return getDeployment(path, networks[_i].name, revnetId);
|
|
39
|
+
return getDeployment({path: path, networkName: networks[_i].name, revnetId: revnetId});
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -44,7 +45,7 @@ library BannyverseDeploymentLib {
|
|
|
44
45
|
|
|
45
46
|
function getDeployment(
|
|
46
47
|
string memory path,
|
|
47
|
-
string memory
|
|
48
|
+
string memory networkName,
|
|
48
49
|
uint256 revnetId
|
|
49
50
|
)
|
|
50
51
|
internal
|
|
@@ -52,7 +53,12 @@ library BannyverseDeploymentLib {
|
|
|
52
53
|
returns (BannyverseDeployment memory deployment)
|
|
53
54
|
{
|
|
54
55
|
deployment.resolver = Banny721TokenUriResolver(
|
|
55
|
-
_getDeploymentAddress(
|
|
56
|
+
_getDeploymentAddress({
|
|
57
|
+
path: path,
|
|
58
|
+
projectName: "banny-core-v6",
|
|
59
|
+
networkName: networkName,
|
|
60
|
+
contractName: "Banny721TokenUriResolver"
|
|
61
|
+
})
|
|
56
62
|
);
|
|
57
63
|
|
|
58
64
|
deployment.revnetId = revnetId;
|
|
@@ -65,8 +71,8 @@ library BannyverseDeploymentLib {
|
|
|
65
71
|
/// @return The address of the contract.
|
|
66
72
|
function _getDeploymentAddress(
|
|
67
73
|
string memory path,
|
|
68
|
-
string memory
|
|
69
|
-
string memory
|
|
74
|
+
string memory projectName,
|
|
75
|
+
string memory networkName,
|
|
70
76
|
string memory contractName
|
|
71
77
|
)
|
|
72
78
|
internal
|
|
@@ -74,7 +80,8 @@ library BannyverseDeploymentLib {
|
|
|
74
80
|
returns (address)
|
|
75
81
|
{
|
|
76
82
|
string memory deploymentJson =
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
// forge-lint: disable-next-line(unsafe-cheatcode)
|
|
84
|
+
vm.readFile(string.concat(path, projectName, "/", networkName, "/", contractName, ".json"));
|
|
85
|
+
return stdJson.readAddress({json: deploymentJson, key: ".address"});
|
|
79
86
|
}
|
|
80
87
|
}
|
|
@@ -7,7 +7,7 @@ import {IJB721TiersHookStore} from "@bananapus/721-hook-v6/src/interfaces/IJB721
|
|
|
7
7
|
|
|
8
8
|
library MigrationHelper {
|
|
9
9
|
/// @notice Get the UPC (tier ID) from a token ID
|
|
10
|
-
function
|
|
10
|
+
function _getUpc(address hook, uint256 tokenId) internal view returns (uint256) {
|
|
11
11
|
IJB721TiersHookStore store = JB721TiersHook(hook).STORE();
|
|
12
12
|
return store.tierOfTokenId({hook: hook, tokenId: tokenId, includeResolvedUri: false}).id;
|
|
13
13
|
}
|
|
@@ -24,22 +24,24 @@ library MigrationHelper {
|
|
|
24
24
|
view
|
|
25
25
|
{
|
|
26
26
|
// Get V5 asset token IDs (from V5 hook)
|
|
27
|
-
(uint256 v5BackgroundId, uint256[] memory v5OutfitIds) =
|
|
27
|
+
(uint256 v5BackgroundId, uint256[] memory v5OutfitIds) =
|
|
28
|
+
resolver.assetIdsOf({hook: hookAddress, bannyBodyId: tokenId});
|
|
28
29
|
// Get V4 asset token IDs (from V4 hook)
|
|
29
|
-
(uint256 v4BackgroundId, uint256[] memory v4OutfitIds) =
|
|
30
|
+
(uint256 v4BackgroundId, uint256[] memory v4OutfitIds) =
|
|
31
|
+
v4Resolver.assetIdsOf({hook: v4HookAddress, bannyBodyId: tokenId});
|
|
30
32
|
|
|
31
33
|
// Compare background UPCs (not token IDs, since they may differ)
|
|
32
|
-
uint256
|
|
33
|
-
uint256
|
|
34
|
+
uint256 v5BackgroundUpc = v5BackgroundId == 0 ? 0 : _getUpc({hook: hookAddress, tokenId: v5BackgroundId});
|
|
35
|
+
uint256 v4BackgroundUpc = v4BackgroundId == 0 ? 0 : _getUpc({hook: v4HookAddress, tokenId: v4BackgroundId});
|
|
34
36
|
|
|
35
|
-
bool matches =
|
|
37
|
+
bool matches = v5BackgroundUpc == v4BackgroundUpc && v5OutfitIds.length == v4OutfitIds.length;
|
|
36
38
|
|
|
37
39
|
if (matches) {
|
|
38
40
|
// Compare outfit UPCs
|
|
39
41
|
for (uint256 i = 0; i < v5OutfitIds.length; i++) {
|
|
40
|
-
uint256
|
|
41
|
-
uint256
|
|
42
|
-
if (
|
|
42
|
+
uint256 v5OutfitUpc = _getUpc({hook: hookAddress, tokenId: v5OutfitIds[i]});
|
|
43
|
+
uint256 v4OutfitUpc = _getUpc({hook: v4HookAddress, tokenId: v4OutfitIds[i]});
|
|
44
|
+
if (v5OutfitUpc != v4OutfitUpc) {
|
|
43
45
|
matches = false;
|
|
44
46
|
break;
|
|
45
47
|
}
|
|
@@ -48,17 +50,17 @@ library MigrationHelper {
|
|
|
48
50
|
|
|
49
51
|
if (!matches) {
|
|
50
52
|
// Try fallback resolver
|
|
51
|
-
(v4BackgroundId, v4OutfitIds) = fallbackV4Resolver.assetIdsOf(v4HookAddress, tokenId);
|
|
52
|
-
|
|
53
|
+
(v4BackgroundId, v4OutfitIds) = fallbackV4Resolver.assetIdsOf({hook: v4HookAddress, bannyBodyId: tokenId});
|
|
54
|
+
v4BackgroundUpc = v4BackgroundId == 0 ? 0 : _getUpc({hook: v4HookAddress, tokenId: v4BackgroundId});
|
|
53
55
|
|
|
54
56
|
require(
|
|
55
|
-
|
|
57
|
+
v5BackgroundUpc == v4BackgroundUpc && v5OutfitIds.length == v4OutfitIds.length, "V4/V5 asset mismatch"
|
|
56
58
|
);
|
|
57
59
|
|
|
58
60
|
for (uint256 i = 0; i < v5OutfitIds.length; i++) {
|
|
59
|
-
uint256
|
|
60
|
-
uint256
|
|
61
|
-
require(
|
|
61
|
+
uint256 v5OutfitUpc = _getUpc({hook: hookAddress, tokenId: v5OutfitIds[i]});
|
|
62
|
+
uint256 v4OutfitUpc = _getUpc({hook: v4HookAddress, tokenId: v4OutfitIds[i]});
|
|
63
|
+
require(v5OutfitUpc == v4OutfitUpc, "V4/V5 asset mismatch");
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -91,14 +93,14 @@ library MigrationHelper {
|
|
|
91
93
|
// Check if this tier is owned by the fallback resolver in V4
|
|
92
94
|
// If so, skip verification (these are now owned by rightful owners in V5)
|
|
93
95
|
uint256 v4FallbackResolverBalance =
|
|
94
|
-
v4Store.tierBalanceOf(v4HookAddress, v4FallbackResolverAddress, tierId);
|
|
96
|
+
v4Store.tierBalanceOf({hook: v4HookAddress, owner: v4FallbackResolverAddress, tierId: tierId});
|
|
95
97
|
if (v4FallbackResolverBalance > 0) {
|
|
96
98
|
continue;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
// Get V4 and V5 tier balances for this owner and tier
|
|
100
|
-
uint256 v4Balance = v4Store.tierBalanceOf(v4HookAddress, owner, tierId);
|
|
101
|
-
uint256 v5Balance = v5Store.tierBalanceOf(hookAddress, owner, tierId);
|
|
102
|
+
uint256 v4Balance = v4Store.tierBalanceOf({hook: v4HookAddress, owner: owner, tierId: tierId});
|
|
103
|
+
uint256 v5Balance = v5Store.tierBalanceOf({hook: hookAddress, owner: owner, tierId: tierId});
|
|
102
104
|
|
|
103
105
|
// Require that V5 balance is never greater than V4 balance
|
|
104
106
|
require(
|
|
@@ -146,6 +148,7 @@ library MigrationHelper {
|
|
|
146
148
|
bytes memory buffer = new bytes(digits);
|
|
147
149
|
while (value != 0) {
|
|
148
150
|
digits -= 1;
|
|
151
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
149
152
|
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
|
|
150
153
|
value /= 10;
|
|
151
154
|
}
|
|
@@ -108,10 +108,15 @@ contract Banny721TokenUriResolver is
|
|
|
108
108
|
/// @custom:param upc The universal product code that the SVG hash represent.
|
|
109
109
|
mapping(uint256 upc => bytes32) public override svgHashOf;
|
|
110
110
|
|
|
111
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
111
112
|
string public override DEFAULT_ALIEN_EYES;
|
|
113
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
112
114
|
string public override DEFAULT_MOUTH;
|
|
115
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
113
116
|
string public override DEFAULT_NECKLACE;
|
|
117
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
114
118
|
string public override DEFAULT_STANDARD_EYES;
|
|
119
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
115
120
|
string public override BANNY_BODY;
|
|
116
121
|
|
|
117
122
|
//*********************************************************************//
|
|
@@ -299,7 +304,7 @@ contract Banny721TokenUriResolver is
|
|
|
299
304
|
|
|
300
305
|
// Get a reference to the pricing context.
|
|
301
306
|
// slither-disable-next-line unused-return
|
|
302
|
-
(uint256 currency, uint256 decimals
|
|
307
|
+
(uint256 currency, uint256 decimals) = IJB721TiersHook(hook).pricingContext();
|
|
303
308
|
|
|
304
309
|
attributes = string.concat(
|
|
305
310
|
attributes,
|
|
@@ -79,10 +79,12 @@ contract MockStore {
|
|
|
79
79
|
return tiers[hook][tokenId];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
82
83
|
function encodedTierIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
83
84
|
return bytes32(0);
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
86
88
|
function encodedIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
87
89
|
return bytes32(0);
|
|
88
90
|
}
|
|
@@ -166,7 +168,7 @@ contract TestBanny721TokenUriResolver is Test {
|
|
|
166
168
|
// --- Constructor --------------------------------------------------- //
|
|
167
169
|
//*********************************************************************//
|
|
168
170
|
|
|
169
|
-
function test_constructor_setsDefaults() public {
|
|
171
|
+
function test_constructor_setsDefaults() public view {
|
|
170
172
|
assertEq(resolver.BANNY_BODY(), "<path/>");
|
|
171
173
|
assertEq(resolver.DEFAULT_NECKLACE(), "<necklace/>");
|
|
172
174
|
assertEq(resolver.DEFAULT_MOUTH(), "<mouth/>");
|
|
@@ -607,27 +609,27 @@ contract TestBanny721TokenUriResolver is Test {
|
|
|
607
609
|
resolver.decorateBannyWith(address(hook), BODY_TOKEN, 0, outfitIds1);
|
|
608
610
|
|
|
609
611
|
// Create a new necklace token.
|
|
610
|
-
uint256
|
|
611
|
-
_setupTier(
|
|
612
|
-
hook.setOwner(
|
|
612
|
+
uint256 necklaceToken2 = 11_000_000_001;
|
|
613
|
+
_setupTier(necklaceToken2, 11, 3); // Same category (3)
|
|
614
|
+
hook.setOwner(necklaceToken2, alice);
|
|
613
615
|
|
|
614
616
|
// Replace with new necklace. Old one should be returned.
|
|
615
617
|
uint256[] memory outfitIds2 = new uint256[](1);
|
|
616
|
-
outfitIds2[0] =
|
|
618
|
+
outfitIds2[0] = necklaceToken2;
|
|
617
619
|
vm.prank(alice);
|
|
618
620
|
resolver.decorateBannyWith(address(hook), BODY_TOKEN, 0, outfitIds2);
|
|
619
621
|
|
|
620
622
|
// Old necklace returned to alice.
|
|
621
623
|
assertEq(hook.ownerOf(NECKLACE_TOKEN), alice, "old necklace should be returned");
|
|
622
624
|
// New necklace held by resolver.
|
|
623
|
-
assertEq(hook.ownerOf(
|
|
625
|
+
assertEq(hook.ownerOf(necklaceToken2), address(resolver), "new necklace should be held");
|
|
624
626
|
}
|
|
625
627
|
|
|
626
628
|
//*********************************************************************//
|
|
627
629
|
// --- onERC721Received ---------------------------------------------- //
|
|
628
630
|
//*********************************************************************//
|
|
629
631
|
|
|
630
|
-
function test_onERC721Received_acceptsFromSelf() public {
|
|
632
|
+
function test_onERC721Received_acceptsFromSelf() public view {
|
|
631
633
|
bytes4 result = resolver.onERC721Received(address(resolver), alice, 1, "");
|
|
632
634
|
assertEq(result, IERC721Receiver.onERC721Received.selector, "should accept from self");
|
|
633
635
|
}
|
|
@@ -641,7 +643,7 @@ contract TestBanny721TokenUriResolver is Test {
|
|
|
641
643
|
// --- View: assetIdsOf with no outfits ------------------------------ //
|
|
642
644
|
//*********************************************************************//
|
|
643
645
|
|
|
644
|
-
function test_assetIdsOf_empty() public {
|
|
646
|
+
function test_assetIdsOf_empty() public view {
|
|
645
647
|
(uint256 backgroundId, uint256[] memory outfitIds) = resolver.assetIdsOf(address(hook), BODY_TOKEN);
|
|
646
648
|
assertEq(backgroundId, 0, "no background initially");
|
|
647
649
|
assertEq(outfitIds.length, 0, "no outfits initially");
|
|
@@ -651,11 +653,11 @@ contract TestBanny721TokenUriResolver is Test {
|
|
|
651
653
|
// --- View: userOf / wearerOf --------------------------------------- //
|
|
652
654
|
//*********************************************************************//
|
|
653
655
|
|
|
654
|
-
function test_userOf_returnsZeroIfNotAttached() public {
|
|
656
|
+
function test_userOf_returnsZeroIfNotAttached() public view {
|
|
655
657
|
assertEq(resolver.userOf(address(hook), BACKGROUND_TOKEN), 0, "no user initially");
|
|
656
658
|
}
|
|
657
659
|
|
|
658
|
-
function test_wearerOf_returnsZeroIfNotWorn() public {
|
|
660
|
+
function test_wearerOf_returnsZeroIfNotWorn() public view {
|
|
659
661
|
assertEq(resolver.wearerOf(address(hook), NECKLACE_TOKEN), 0, "no wearer initially");
|
|
660
662
|
}
|
|
661
663
|
|
package/test/BannyAttacks.t.sol
CHANGED
|
@@ -70,10 +70,12 @@ contract AttackMockStore {
|
|
|
70
70
|
return tiers[hook][tokenId];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
73
74
|
function encodedTierIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
74
75
|
return bytes32(0);
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
77
79
|
function encodedIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
78
80
|
return bytes32(0);
|
|
79
81
|
}
|
package/test/DecorateFlow.t.sol
CHANGED
|
@@ -70,10 +70,12 @@ contract DecorateFlowMockStore {
|
|
|
70
70
|
return tiers[hook][tokenId];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
73
74
|
function encodedTierIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
74
75
|
return bytes32(0);
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
77
79
|
function encodedIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
78
80
|
return bytes32(0);
|
|
79
81
|
}
|
package/test/Fork.t.sol
CHANGED
|
@@ -27,7 +27,6 @@ import {JB721TiersHookFlags} from "@bananapus/721-hook-v6/src/structs/JB721Tiers
|
|
|
27
27
|
import {JBDeploy721TiersHookConfig} from "@bananapus/721-hook-v6/src/structs/JBDeploy721TiersHookConfig.sol";
|
|
28
28
|
import {JB721Tier} from "@bananapus/721-hook-v6/src/structs/JB721Tier.sol";
|
|
29
29
|
import {IJB721TokenUriResolver} from "@bananapus/721-hook-v6/src/interfaces/IJB721TokenUriResolver.sol";
|
|
30
|
-
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
31
30
|
import {JBCurrencyIds} from "@bananapus/core-v6/src/libraries/JBCurrencyIds.sol";
|
|
32
31
|
import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
33
32
|
|
|
@@ -113,10 +112,12 @@ contract ReentrantMockStore {
|
|
|
113
112
|
return tiers[hook][tokenId];
|
|
114
113
|
}
|
|
115
114
|
|
|
115
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
116
116
|
function encodedTierIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
117
117
|
return bytes32(0);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
120
121
|
function encodedIPFSUriOf(address, uint256) external pure returns (bytes32) {
|
|
121
122
|
return bytes32(0);
|
|
122
123
|
}
|
|
@@ -299,13 +300,13 @@ contract BannyForkTest is Test {
|
|
|
299
300
|
assertEq(IERC721(address(bannyHook)).ownerOf(ORIGINAL_BODY_1), alice);
|
|
300
301
|
}
|
|
301
302
|
|
|
302
|
-
function test_fork_e2e_alienBodyDefaultEyes() public {
|
|
303
|
+
function test_fork_e2e_alienBodyDefaultEyes() public view {
|
|
303
304
|
// Alice owns ALIEN_BODY_1. Naked alien body should inject alien eyes in SVG.
|
|
304
305
|
string memory svg = resolver.svgOf(address(bannyHook), ALIEN_BODY_1, true, false);
|
|
305
306
|
assertGt(bytes(svg).length, 0, "alien body SVG should render");
|
|
306
307
|
}
|
|
307
308
|
|
|
308
|
-
function test_fork_e2e_outfitRenderedOnMannequin() public {
|
|
309
|
+
function test_fork_e2e_outfitRenderedOnMannequin() public view {
|
|
309
310
|
// Unequipped outfit token should render on mannequin.
|
|
310
311
|
string memory uri = resolver.tokenUriOf(address(bannyHook), NECKLACE_1);
|
|
311
312
|
assertGt(bytes(uri).length, 0, "outfit URI should render on mannequin");
|
|
@@ -781,14 +782,14 @@ contract BannyForkTest is Test {
|
|
|
781
782
|
// 7. TOKEN URI RENDERING
|
|
782
783
|
// ═══════════════════════════════════════════════════════════════════════
|
|
783
784
|
|
|
784
|
-
function test_fork_render_nakedBodyHasDefaultInjections() public {
|
|
785
|
+
function test_fork_render_nakedBodyHasDefaultInjections() public view {
|
|
785
786
|
// A naked body should still render with default necklace, eyes, mouth.
|
|
786
787
|
string memory svg = resolver.svgOf(address(bannyHook), ORIGINAL_BODY_1, true, false);
|
|
787
788
|
assertGt(bytes(svg).length, 0, "naked body should render");
|
|
788
789
|
// The SVG should contain the body path and defaults.
|
|
789
790
|
}
|
|
790
791
|
|
|
791
|
-
function test_fork_render_allFourBodyTypes() public {
|
|
792
|
+
function test_fork_render_allFourBodyTypes() public view {
|
|
792
793
|
// Each body type should render.
|
|
793
794
|
string memory alienSvg = resolver.svgOf(address(bannyHook), ALIEN_BODY_1, true, false);
|
|
794
795
|
string memory pinkSvg = resolver.svgOf(address(bannyHook), PINK_BODY_1, true, false);
|
|
@@ -1011,17 +1012,17 @@ contract BannyForkTest is Test {
|
|
|
1011
1012
|
assertEq(outfitIds.length, 0);
|
|
1012
1013
|
}
|
|
1013
1014
|
|
|
1014
|
-
function test_fork_edge_assetIdsEmptyInitially() public {
|
|
1015
|
+
function test_fork_edge_assetIdsEmptyInitially() public view {
|
|
1015
1016
|
(uint256 bgId, uint256[] memory outfitIds) = resolver.assetIdsOf(address(bannyHook), ORIGINAL_BODY_1);
|
|
1016
1017
|
assertEq(bgId, 0);
|
|
1017
1018
|
assertEq(outfitIds.length, 0);
|
|
1018
1019
|
}
|
|
1019
1020
|
|
|
1020
|
-
function test_fork_edge_wearerOfUnwornReturnsZero() public {
|
|
1021
|
+
function test_fork_edge_wearerOfUnwornReturnsZero() public view {
|
|
1021
1022
|
assertEq(resolver.wearerOf(address(bannyHook), NECKLACE_1), 0);
|
|
1022
1023
|
}
|
|
1023
1024
|
|
|
1024
|
-
function test_fork_edge_userOfUnusedBackgroundReturnsZero() public {
|
|
1025
|
+
function test_fork_edge_userOfUnusedBackgroundReturnsZero() public view {
|
|
1025
1026
|
assertEq(resolver.userOf(address(bannyHook), BACKGROUND_1), 0);
|
|
1026
1027
|
}
|
|
1027
1028
|
|
|
@@ -1136,7 +1137,7 @@ contract BannyForkTest is Test {
|
|
|
1136
1137
|
resolver.decorateBannyWith(address(bannyHook), ORIGINAL_BODY_1, 0, outfits);
|
|
1137
1138
|
}
|
|
1138
1139
|
|
|
1139
|
-
function test_fork_edge_namesReturnsCorrectData() public {
|
|
1140
|
+
function test_fork_edge_namesReturnsCorrectData() public view {
|
|
1140
1141
|
// Verify namesOf returns correct product name for each body type.
|
|
1141
1142
|
(string memory alienFull,,) = resolver.namesOf(address(bannyHook), ALIEN_BODY_1);
|
|
1142
1143
|
assertGt(bytes(alienFull).length, 0, "alien name should not be empty");
|
|
@@ -1791,6 +1792,7 @@ contract BannyForkTest is Test {
|
|
|
1791
1792
|
// Internal helpers
|
|
1792
1793
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1793
1794
|
|
|
1795
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
1794
1796
|
function _deployJBCore() internal {
|
|
1795
1797
|
jbPermissions = new JBPermissions(trustedForwarder);
|
|
1796
1798
|
jbProjects = new JBProjects(multisig, address(0), trustedForwarder);
|
|
@@ -1824,7 +1826,7 @@ contract BannyForkTest is Test {
|
|
|
1824
1826
|
JBAddressRegistry addressRegistry = new JBAddressRegistry();
|
|
1825
1827
|
|
|
1826
1828
|
JB721TiersHook hookImpl =
|
|
1827
|
-
new JB721TiersHook(jbDirectory, jbPermissions, jbRulesets, store, jbSplits, trustedForwarder);
|
|
1829
|
+
new JB721TiersHook(jbDirectory, jbPermissions, jbPrices, jbRulesets, store, jbSplits, trustedForwarder);
|
|
1828
1830
|
|
|
1829
1831
|
hookDeployer = new JB721TiersHookDeployer(hookImpl, store, addressRegistry, trustedForwarder);
|
|
1830
1832
|
}
|
|
@@ -1900,9 +1902,7 @@ contract BannyForkTest is Test {
|
|
|
1900
1902
|
baseUri: "ipfs://",
|
|
1901
1903
|
tokenUriResolver: IJB721TokenUriResolver(address(resolver)),
|
|
1902
1904
|
contractUri: "",
|
|
1903
|
-
tiersConfig: JB721InitTiersConfig({
|
|
1904
|
-
tiers: tiers, currency: JBCurrencyIds.ETH, decimals: 18, prices: IJBPrices(address(0))
|
|
1905
|
-
}),
|
|
1905
|
+
tiersConfig: JB721InitTiersConfig({tiers: tiers, currency: JBCurrencyIds.ETH, decimals: 18}),
|
|
1906
1906
|
reserveBeneficiary: address(0),
|
|
1907
1907
|
flags: JB721TiersHookFlags({
|
|
1908
1908
|
noNewTiersWithReserves: false,
|
|
@@ -1946,6 +1946,7 @@ contract BannyForkTest is Test {
|
|
|
1946
1946
|
});
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
1949
1950
|
function _mintInitialNFTs() internal {
|
|
1950
1951
|
// Mint bodies and outfits to alice, bob.
|
|
1951
1952
|
vm.startPrank(multisig); // hook owner can mint
|