@bannynet/core-v6 0.0.1

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.
Files changed (48) hide show
  1. package/README.md +53 -0
  2. package/SKILLS.md +94 -0
  3. package/deployments/banny-core-v5/arbitrum/Banny721TokenUriResolver.json +1809 -0
  4. package/deployments/banny-core-v5/arbitrum_sepolia/Banny721TokenUriResolver.json +1795 -0
  5. package/deployments/banny-core-v5/base/Banny721TokenUriResolver.json +1810 -0
  6. package/deployments/banny-core-v5/base_sepolia/Banny721TokenUriResolver.json +1796 -0
  7. package/deployments/banny-core-v5/ethereum/Banny721TokenUriResolver.json +1795 -0
  8. package/deployments/banny-core-v5/optimism/Banny721TokenUriResolver.json +1810 -0
  9. package/deployments/banny-core-v5/optimism_sepolia/Banny721TokenUriResolver.json +1796 -0
  10. package/deployments/banny-core-v5/sepolia/Banny721TokenUriResolver.json +1795 -0
  11. package/foundry.toml +22 -0
  12. package/package.json +53 -0
  13. package/remappings.txt +1 -0
  14. package/script/1.Fix.s.sol +290 -0
  15. package/script/Add.Denver.s.sol +75 -0
  16. package/script/AirdropOutfits.s.sol +2302 -0
  17. package/script/Deploy.s.sol +440 -0
  18. package/script/Drop1.s.sol +979 -0
  19. package/script/MigrationContractArbitrum.sol +494 -0
  20. package/script/MigrationContractArbitrum1.sol +170 -0
  21. package/script/MigrationContractArbitrum2.sol +204 -0
  22. package/script/MigrationContractArbitrum3.sol +174 -0
  23. package/script/MigrationContractArbitrum4.sol +478 -0
  24. package/script/MigrationContractBase1.sol +444 -0
  25. package/script/MigrationContractBase2.sol +175 -0
  26. package/script/MigrationContractBase3.sol +309 -0
  27. package/script/MigrationContractBase4.sol +350 -0
  28. package/script/MigrationContractBase5.sol +259 -0
  29. package/script/MigrationContractEthereum1.sol +468 -0
  30. package/script/MigrationContractEthereum2.sol +306 -0
  31. package/script/MigrationContractEthereum3.sol +349 -0
  32. package/script/MigrationContractEthereum4.sol +352 -0
  33. package/script/MigrationContractEthereum5.sol +354 -0
  34. package/script/MigrationContractEthereum6.sol +270 -0
  35. package/script/MigrationContractEthereum7.sol +439 -0
  36. package/script/MigrationContractEthereum8.sol +385 -0
  37. package/script/MigrationContractOptimism.sol +196 -0
  38. package/script/helpers/BannyverseDeploymentLib.sol +73 -0
  39. package/script/helpers/MigrationHelper.sol +155 -0
  40. package/script/outfit_drop/generate-migration.js +3441 -0
  41. package/script/outfit_drop/raw.json +43276 -0
  42. package/slither-ci.config.json +10 -0
  43. package/sphinx.lock +521 -0
  44. package/src/Banny721TokenUriResolver.sol +1288 -0
  45. package/src/interfaces/IBanny721TokenUriResolver.sol +137 -0
  46. package/test/Banny721TokenUriResolver.t.sol +669 -0
  47. package/test/BannyAttacks.t.sol +322 -0
  48. package/test/DecorateFlow.t.sol +1056 -0
@@ -0,0 +1,259 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity 0.8.23;
3
+
4
+ import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
5
+ import {JB721TiersHook} from "@bananapus/721-hook-v5/src/JB721TiersHook.sol";
6
+ import {Banny721TokenUriResolver} from "../src/Banny721TokenUriResolver.sol";
7
+ import {MigrationHelper} from "./helpers/MigrationHelper.sol";
8
+
9
+ /// @notice Migration contract for Base to handle standalone outfits and backgrounds
10
+ /// that are not worn/used by any banny. These assets are minted to this contract
11
+ /// and then transferred directly to their owners.
12
+ contract MigrationContractBase5 {
13
+ address[] private transferOwners;
14
+
15
+ constructor(address[] memory _transferOwners) {
16
+ transferOwners = _transferOwners;
17
+ }
18
+
19
+ function executeMigration(
20
+ address hookAddress,
21
+ address resolverAddress,
22
+ address v4HookAddress,
23
+ address v4ResolverAddress,
24
+ address fallbackV4ResolverAddress
25
+ )
26
+ external
27
+ {
28
+ // Validate addresses
29
+ require(hookAddress != address(0), "Hook address not set");
30
+ require(resolverAddress != address(0), "Resolver address not set");
31
+ require(v4HookAddress != address(0), "V4 Hook address not set");
32
+ require(v4ResolverAddress != address(0), "V4 Resolver address not set");
33
+ require(fallbackV4ResolverAddress != address(0), "V4 fallback resolver address not set");
34
+
35
+ JB721TiersHook hook = JB721TiersHook(hookAddress);
36
+ IERC721 v4Hook = IERC721(v4HookAddress);
37
+
38
+ // Base migration - Standalone outfits and backgrounds (53 items)
39
+ // These are assets that are NOT being worn/used by any banny
40
+
41
+ // Assets are already minted to this contract by the deployer
42
+ // V5 token IDs are calculated based on mint order (continuing from previous chunks)
43
+ // V4 token IDs are the original token IDs from V4
44
+
45
+ // Generate token IDs - store both V5 minted token IDs and original V4 token IDs
46
+ uint256[] memory v5TokenIds = new uint256[](transferOwners.length);
47
+ uint256[] memory v4TokenIds = new uint256[](transferOwners.length);
48
+ v5TokenIds[0] = 5_000_000_004; // Minted V5 Token ID
49
+ v4TokenIds[0] = 5_000_000_002; // Original V4 Token ID
50
+ v5TokenIds[1] = 5_000_000_005; // Minted V5 Token ID
51
+ v4TokenIds[1] = 5_000_000_005; // Original V4 Token ID
52
+ v5TokenIds[2] = 6_000_000_005; // Minted V5 Token ID
53
+ v4TokenIds[2] = 6_000_000_002; // Original V4 Token ID
54
+ v5TokenIds[3] = 7_000_000_001; // Minted V5 Token ID
55
+ v4TokenIds[3] = 7_000_000_001; // Original V4 Token ID
56
+ v5TokenIds[4] = 10_000_000_006; // Minted V5 Token ID
57
+ v4TokenIds[4] = 10_000_000_002; // Original V4 Token ID
58
+ v5TokenIds[5] = 10_000_000_007; // Minted V5 Token ID
59
+ v4TokenIds[5] = 10_000_000_006; // Original V4 Token ID
60
+ v5TokenIds[6] = 10_000_000_008; // Minted V5 Token ID
61
+ v4TokenIds[6] = 10_000_000_008; // Original V4 Token ID
62
+ v5TokenIds[7] = 10_000_000_009; // Minted V5 Token ID
63
+ v4TokenIds[7] = 10_000_000_009; // Original V4 Token ID
64
+ v5TokenIds[8] = 10_000_000_010; // Minted V5 Token ID
65
+ v4TokenIds[8] = 10_000_000_010; // Original V4 Token ID
66
+ v5TokenIds[9] = 10_000_000_011; // Minted V5 Token ID
67
+ v4TokenIds[9] = 10_000_000_011; // Original V4 Token ID
68
+ v5TokenIds[10] = 11_000_000_002; // Minted V5 Token ID
69
+ v4TokenIds[10] = 11_000_000_002; // Original V4 Token ID
70
+ v5TokenIds[11] = 11_000_000_003; // Minted V5 Token ID
71
+ v4TokenIds[11] = 11_000_000_003; // Original V4 Token ID
72
+ v5TokenIds[12] = 13_000_000_002; // Minted V5 Token ID
73
+ v4TokenIds[12] = 13_000_000_002; // Original V4 Token ID
74
+ v5TokenIds[13] = 14_000_000_004; // Minted V5 Token ID
75
+ v4TokenIds[13] = 14_000_000_004; // Original V4 Token ID
76
+ v5TokenIds[14] = 17_000_000_001; // Minted V5 Token ID
77
+ v4TokenIds[14] = 17_000_000_001; // Original V4 Token ID
78
+ v5TokenIds[15] = 19_000_000_008; // Minted V5 Token ID
79
+ v4TokenIds[15] = 19_000_000_002; // Original V4 Token ID
80
+ v5TokenIds[16] = 19_000_000_009; // Minted V5 Token ID
81
+ v4TokenIds[16] = 19_000_000_004; // Original V4 Token ID
82
+ v5TokenIds[17] = 19_000_000_010; // Minted V5 Token ID
83
+ v4TokenIds[17] = 19_000_000_010; // Original V4 Token ID
84
+ v5TokenIds[18] = 19_000_000_011; // Minted V5 Token ID
85
+ v4TokenIds[18] = 19_000_000_011; // Original V4 Token ID
86
+ v5TokenIds[19] = 19_000_000_012; // Minted V5 Token ID
87
+ v4TokenIds[19] = 19_000_000_012; // Original V4 Token ID
88
+ v5TokenIds[20] = 24_000_000_001; // Minted V5 Token ID
89
+ v4TokenIds[20] = 24_000_000_001; // Original V4 Token ID
90
+ v5TokenIds[21] = 25_000_000_009; // Minted V5 Token ID
91
+ v4TokenIds[21] = 25_000_000_003; // Original V4 Token ID
92
+ v5TokenIds[22] = 28_000_000_007; // Minted V5 Token ID
93
+ v4TokenIds[22] = 28_000_000_003; // Original V4 Token ID
94
+ v5TokenIds[23] = 28_000_000_008; // Minted V5 Token ID
95
+ v4TokenIds[23] = 28_000_000_006; // Original V4 Token ID
96
+ v5TokenIds[24] = 28_000_000_009; // Minted V5 Token ID
97
+ v4TokenIds[24] = 28_000_000_009; // Original V4 Token ID
98
+ v5TokenIds[25] = 28_000_000_010; // Minted V5 Token ID
99
+ v4TokenIds[25] = 28_000_000_010; // Original V4 Token ID
100
+ v5TokenIds[26] = 31_000_000_003; // Minted V5 Token ID
101
+ v4TokenIds[26] = 31_000_000_003; // Original V4 Token ID
102
+ v5TokenIds[27] = 31_000_000_004; // Minted V5 Token ID
103
+ v4TokenIds[27] = 31_000_000_004; // Original V4 Token ID
104
+ v5TokenIds[28] = 31_000_000_005; // Minted V5 Token ID
105
+ v4TokenIds[28] = 31_000_000_005; // Original V4 Token ID
106
+ v5TokenIds[29] = 31_000_000_006; // Minted V5 Token ID
107
+ v4TokenIds[29] = 31_000_000_006; // Original V4 Token ID
108
+ v5TokenIds[30] = 32_000_000_002; // Minted V5 Token ID
109
+ v4TokenIds[30] = 32_000_000_002; // Original V4 Token ID
110
+ v5TokenIds[31] = 34_000_000_001; // Minted V5 Token ID
111
+ v4TokenIds[31] = 34_000_000_001; // Original V4 Token ID
112
+ v5TokenIds[32] = 35_000_000_002; // Minted V5 Token ID
113
+ v4TokenIds[32] = 35_000_000_001; // Original V4 Token ID
114
+ v5TokenIds[33] = 35_000_000_003; // Minted V5 Token ID
115
+ v4TokenIds[33] = 35_000_000_003; // Original V4 Token ID
116
+ v5TokenIds[34] = 35_000_000_004; // Minted V5 Token ID
117
+ v4TokenIds[34] = 35_000_000_004; // Original V4 Token ID
118
+ v5TokenIds[35] = 38_000_000_003; // Minted V5 Token ID
119
+ v4TokenIds[35] = 38_000_000_003; // Original V4 Token ID
120
+ v5TokenIds[36] = 39_000_000_002; // Minted V5 Token ID
121
+ v4TokenIds[36] = 39_000_000_002; // Original V4 Token ID
122
+ v5TokenIds[37] = 40_000_000_002; // Minted V5 Token ID
123
+ v4TokenIds[37] = 40_000_000_002; // Original V4 Token ID
124
+ v5TokenIds[38] = 40_000_000_003; // Minted V5 Token ID
125
+ v4TokenIds[38] = 40_000_000_003; // Original V4 Token ID
126
+ v5TokenIds[39] = 41_000_000_002; // Minted V5 Token ID
127
+ v4TokenIds[39] = 41_000_000_002; // Original V4 Token ID
128
+ v5TokenIds[40] = 42_000_000_001; // Minted V5 Token ID
129
+ v4TokenIds[40] = 42_000_000_001; // Original V4 Token ID
130
+ v5TokenIds[41] = 42_000_000_002; // Minted V5 Token ID
131
+ v4TokenIds[41] = 42_000_000_002; // Original V4 Token ID
132
+ v5TokenIds[42] = 43_000_000_007; // Minted V5 Token ID
133
+ v4TokenIds[42] = 43_000_000_001; // Original V4 Token ID
134
+ v5TokenIds[43] = 43_000_000_008; // Minted V5 Token ID
135
+ v4TokenIds[43] = 43_000_000_004; // Original V4 Token ID
136
+ v5TokenIds[44] = 44_000_000_004; // Minted V5 Token ID
137
+ v4TokenIds[44] = 44_000_000_002; // Original V4 Token ID
138
+ v5TokenIds[45] = 44_000_000_005; // Minted V5 Token ID
139
+ v4TokenIds[45] = 44_000_000_003; // Original V4 Token ID
140
+ v5TokenIds[46] = 47_000_000_004; // Minted V5 Token ID
141
+ v4TokenIds[46] = 47_000_000_002; // Original V4 Token ID
142
+ v5TokenIds[47] = 47_000_000_005; // Minted V5 Token ID
143
+ v4TokenIds[47] = 47_000_000_004; // Original V4 Token ID
144
+ v5TokenIds[48] = 47_000_000_006; // Minted V5 Token ID
145
+ v4TokenIds[48] = 47_000_000_006; // Original V4 Token ID
146
+ v5TokenIds[49] = 47_000_000_007; // Minted V5 Token ID
147
+ v4TokenIds[49] = 47_000_000_007; // Original V4 Token ID
148
+ v5TokenIds[50] = 47_000_000_008; // Minted V5 Token ID
149
+ v4TokenIds[50] = 47_000_000_008; // Original V4 Token ID
150
+ v5TokenIds[51] = 49_000_000_001; // Minted V5 Token ID
151
+ v4TokenIds[51] = 49_000_000_001; // Original V4 Token ID
152
+ v5TokenIds[52] = 49_000_000_002; // Minted V5 Token ID
153
+ v4TokenIds[52] = 49_000_000_002; // Original V4 Token ID
154
+
155
+ uint256 successfulTransfers = 0;
156
+
157
+ for (uint256 i = 0; i < transferOwners.length; i++) {
158
+ uint256 v5TokenId = v5TokenIds[i];
159
+ uint256 v4TokenId = v4TokenIds[i];
160
+
161
+ // Verify V4 ownership using the original V4 token ID
162
+ // This will revert if the token doesn't exist, which indicates a data issue
163
+ address v4Owner = v4Hook.ownerOf(v4TokenId);
164
+ address expectedOwner = transferOwners[i];
165
+
166
+ // If V4 owner is the main resolver, this token is being worn/used and shouldn't be in unused assets
167
+ // contract
168
+ require(
169
+ v4Owner != address(v4ResolverAddress),
170
+ "Token owned by main resolver in V4 - should not be in unused assets contract"
171
+ );
172
+
173
+ // Special case: If V4 owner is the fallback resolver BUT expected owner is NOT a resolver,
174
+ // this is valid - the asset is being worn in V4 but we're minting directly to the actual owner in V5
175
+ // raw.json already accounts for this and has the correct owner
176
+ if (v4Owner == address(fallbackV4ResolverAddress)) {
177
+ // Allow if expected owner is not a resolver (we're minting directly to owner in V5)
178
+ require(
179
+ expectedOwner != address(v4ResolverAddress) && expectedOwner != address(fallbackV4ResolverAddress),
180
+ "Token owned by fallback resolver in V4 but expected owner is also a resolver - should not be in unused assets contract"
181
+ );
182
+ // Skip ownership verification in this case - we trust raw.json
183
+ } else {
184
+ // For all other cases, verify V4 owner matches expected owner
185
+ require(v4Owner == expectedOwner, "V4/V5 ownership mismatch for token");
186
+ }
187
+
188
+ // Verify this contract owns the V5 token before transferring
189
+ require(hook.ownerOf(v5TokenId) == address(this), "Contract does not own token");
190
+
191
+ // Transfer using the minted V5 token ID
192
+ IERC721(address(hook)).safeTransferFrom(address(this), transferOwners[i], v5TokenId);
193
+ successfulTransfers++;
194
+ }
195
+
196
+ // Verify all expected items were transferred
197
+ require(successfulTransfers == transferOwners.length, "Not all items were transferred");
198
+
199
+ // Final verification: Ensure this contract no longer owns any tokens
200
+ // This ensures all transfers completed successfully and no tokens were left behind
201
+ require(hook.balanceOf(address(this)) == 0, "Contract still owns tokens after migration");
202
+
203
+ // Verify tier balances: V5 should never exceed V4 (except for tiers owned by fallback resolver in V4)
204
+
205
+ // // Collect unique owners
206
+ // address[] memory uniqueOwners = new address[](12);
207
+
208
+ // uniqueOwners[0] = 0x8b80755C441d355405CA7571443Bb9247B77Ec16;
209
+ // uniqueOwners[1] = 0xf7253A0E87E39d2cD6365919D4a3D56D431D0041;
210
+ // uniqueOwners[2] = 0x328809A567b87b6123462c3062e8438BBB75c1c5;
211
+ // uniqueOwners[3] = 0xFB46349c0A3F04150E8c731B3A4fC415b0850CE3;
212
+ // uniqueOwners[4] = 0xaECD6D9172d602b93dBA3981991268b44af8096e;
213
+ // uniqueOwners[5] = 0xFd37f4625CA5816157D55a5b3F7Dd8DD5F8a0C2F;
214
+ // uniqueOwners[6] = 0x18deEE9699526f8C8a87004b2e4e55029Fb26b9a;
215
+ // uniqueOwners[7] = 0xbeC26FFa12c90217943D1b2958f60A821aE6E549;
216
+ // uniqueOwners[8] = 0x99Fa48ccEa8a38CDE6B437450fF9bBdDAFAA4Fc8;
217
+ // uniqueOwners[9] = 0x565B93a15d38aCD79c120b15432D21E21eD274d6;
218
+ // uniqueOwners[10] = 0x8DFBdEEC8c5d4970BB5F481C6ec7f73fa1C65be5;
219
+ // uniqueOwners[11] = 0x1C51517d8277C9aD6d701Fb5394ceC0C18219eDb;
220
+
221
+ // // Collect unique tier IDs
222
+ // uint256[] memory uniqueTierIds = new uint256[](25);
223
+
224
+ // uniqueTierIds[0] = 5;
225
+ // uniqueTierIds[1] = 6;
226
+ // uniqueTierIds[2] = 7;
227
+ // uniqueTierIds[3] = 10;
228
+ // uniqueTierIds[4] = 11;
229
+ // uniqueTierIds[5] = 13;
230
+ // uniqueTierIds[6] = 14;
231
+ // uniqueTierIds[7] = 17;
232
+ // uniqueTierIds[8] = 19;
233
+ // uniqueTierIds[9] = 24;
234
+ // uniqueTierIds[10] = 25;
235
+ // uniqueTierIds[11] = 28;
236
+ // uniqueTierIds[12] = 31;
237
+ // uniqueTierIds[13] = 32;
238
+ // uniqueTierIds[14] = 34;
239
+ // uniqueTierIds[15] = 35;
240
+ // uniqueTierIds[16] = 38;
241
+ // uniqueTierIds[17] = 39;
242
+ // uniqueTierIds[18] = 40;
243
+ // uniqueTierIds[19] = 41;
244
+ // uniqueTierIds[20] = 42;
245
+ // uniqueTierIds[21] = 43;
246
+ // uniqueTierIds[22] = 44;
247
+ // uniqueTierIds[23] = 47;
248
+ // uniqueTierIds[24] = 49;
249
+
250
+ // // Verify tier balances: V5 should never exceed V4 (except for tiers owned by fallback resolver in V4)
251
+ // MigrationHelper.verifyTierBalances(
252
+ // hookAddress,
253
+ // v4HookAddress,
254
+ // fallbackV4ResolverAddress,
255
+ // uniqueOwners,
256
+ // uniqueTierIds
257
+ // );
258
+ }
259
+ }