@zoralabs/coins 2.3.0 → 2.4.0

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 (72) hide show
  1. package/.turbo/turbo-build$colon$js.log +119 -101
  2. package/CHANGELOG.md +31 -1
  3. package/README.md +1 -0
  4. package/abis/AddressConstants.json +7 -0
  5. package/abis/BaseTest.json +65 -3
  6. package/abis/BuySupplyWithV4SwapHook.json +429 -0
  7. package/abis/FeeEstimatorHook.json +23 -0
  8. package/abis/ITrustedMsgSenderProviderLookup.json +21 -0
  9. package/abis/IUniswapV4Router04.json +484 -0
  10. package/abis/IZoraV4CoinHook.json +5 -0
  11. package/abis/MockAirlock.json +39 -0
  12. package/abis/SimpleERC20.json +326 -0
  13. package/abis/TrustedMsgSenderProviderLookup.json +215 -0
  14. package/abis/VmContractHelper242.json +233 -0
  15. package/abis/ZoraV4CoinHook.json +21 -3
  16. package/addresses/8453.json +7 -9
  17. package/audits/report-cantinacode-zora-1021.pdf +0 -0
  18. package/dist/index.cjs +140 -19
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.js +139 -18
  21. package/dist/index.js.map +1 -1
  22. package/dist/wagmiGenerated.d.ts +205 -28
  23. package/dist/wagmiGenerated.d.ts.map +1 -1
  24. package/foundry.toml +5 -1
  25. package/package/wagmiGenerated.ts +139 -18
  26. package/package.json +3 -3
  27. package/script/DeployPostDeploymentHooks.s.sol +1 -3
  28. package/script/DeployTrustedMsgSenderLookup.s.sol +20 -0
  29. package/src/deployment/CoinsDeployerBase.sol +31 -9
  30. package/src/hooks/ZoraV4CoinHook.sol +19 -55
  31. package/src/hooks/deployment/BuySupplyWithV4SwapHook.sol +310 -0
  32. package/src/interfaces/ITrustedMsgSenderProviderLookup.sol +18 -0
  33. package/src/interfaces/IZoraV4CoinHook.sol +3 -0
  34. package/src/libs/HooksDeployment.sol +9 -8
  35. package/src/libs/V4Liquidity.sol +50 -6
  36. package/src/utils/AutoSwapper.sol +1 -1
  37. package/src/utils/TrustedMsgSenderProviderLookup.sol +73 -0
  38. package/src/version/ContractVersionBase.sol +1 -1
  39. package/test/BuySupplyWithV4SwapHook.t.sol +509 -0
  40. package/test/Coin.t.sol +21 -9
  41. package/test/CoinUniV4.t.sol +1 -2
  42. package/test/ContentCoinRewards.t.sol +1 -3
  43. package/test/CreatorCoin.t.sol +1 -4
  44. package/test/CreatorCoinRewards.t.sol +5 -3
  45. package/test/Factory.t.sol +3 -3
  46. package/test/HooksDeployment.t.sol +58 -6
  47. package/test/LiquidityMigration.t.sol +6 -2
  48. package/test/MultiOwnable.t.sol +4 -4
  49. package/test/TrustedMsgSenderProviderLookup.t.sol +112 -0
  50. package/test/Upgrades.t.sol +41 -27
  51. package/test/ZoraHookRegistry.t.sol +19 -9
  52. package/test/mocks/MockAirlock.sol +22 -0
  53. package/test/mocks/SimpleERC20.sol +8 -0
  54. package/test/utils/BaseTest.sol +185 -6
  55. package/test/utils/FeeEstimatorHook.sol +3 -1
  56. package/test/utils/TrustedSenderTestHelper.sol +18 -0
  57. package/test/utils/hookmate/README.md +50 -0
  58. package/test/utils/hookmate/artifacts/DeployHelper.sol +20 -0
  59. package/test/utils/hookmate/artifacts/Permit2.sol +16 -0
  60. package/test/utils/hookmate/artifacts/UniversalRouter.sol +29 -0
  61. package/test/utils/hookmate/artifacts/V4PoolManager.sol +17 -0
  62. package/test/utils/hookmate/artifacts/V4PositionManager.sol +23 -0
  63. package/test/utils/hookmate/artifacts/V4Quoter.sol +17 -0
  64. package/test/utils/hookmate/artifacts/V4Router.sol +18 -0
  65. package/test/utils/hookmate/constants/AddressConstants.sol +193 -0
  66. package/test/utils/hookmate/interfaces/router/IUniswapV4Router04.sol +173 -0
  67. package/test/utils/hookmate/interfaces/router/PathKey.sol +34 -0
  68. package/test/utils/hookmate/test/utils/SwapFeeEventAsserter.sol +24 -0
  69. package/wagmi.config.ts +1 -1
  70. package/src/utils/uniswap/BytesLib.sol +0 -35
  71. package/src/utils/uniswap/Path.sol +0 -31
  72. /package/abis/{VmContractHelper226.json → VmContractHelper235.json} +0 -0
package/dist/index.js CHANGED
@@ -1169,7 +1169,7 @@ var baseCoinABI = [
1169
1169
  { type: "error", inputs: [], name: "SlippageBoundsExceeded" },
1170
1170
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
1171
1171
  ];
1172
- var buySupplyWithSwapRouterHookABI = [
1172
+ var buySupplyWithV4SwapHookABI = [
1173
1173
  {
1174
1174
  type: "constructor",
1175
1175
  inputs: [
@@ -1194,6 +1194,63 @@ var buySupplyWithSwapRouterHookABI = [
1194
1194
  outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1195
1195
  stateMutability: "payable"
1196
1196
  },
1197
+ {
1198
+ type: "function",
1199
+ inputs: [{ name: "data", internalType: "bytes", type: "bytes" }],
1200
+ name: "decodeV4RouteData",
1201
+ outputs: [
1202
+ {
1203
+ name: "v4Route",
1204
+ internalType: "struct PoolKey[]",
1205
+ type: "tuple[]",
1206
+ components: [
1207
+ { name: "currency0", internalType: "Currency", type: "address" },
1208
+ { name: "currency1", internalType: "Currency", type: "address" },
1209
+ { name: "fee", internalType: "uint24", type: "uint24" },
1210
+ { name: "tickSpacing", internalType: "int24", type: "int24" },
1211
+ { name: "hooks", internalType: "contract IHooks", type: "address" }
1212
+ ]
1213
+ },
1214
+ { name: "startAmount", internalType: "uint256", type: "uint256" }
1215
+ ],
1216
+ stateMutability: "pure"
1217
+ },
1218
+ {
1219
+ type: "function",
1220
+ inputs: [
1221
+ {
1222
+ name: "params",
1223
+ internalType: "struct BuySupplyWithV4SwapHook.InitialSupplyParams",
1224
+ type: "tuple",
1225
+ components: [
1226
+ { name: "buyRecipient", internalType: "address", type: "address" },
1227
+ { name: "v3Route", internalType: "bytes", type: "bytes" },
1228
+ {
1229
+ name: "v4Route",
1230
+ internalType: "struct PoolKey[]",
1231
+ type: "tuple[]",
1232
+ components: [
1233
+ { name: "currency0", internalType: "Currency", type: "address" },
1234
+ { name: "currency1", internalType: "Currency", type: "address" },
1235
+ { name: "fee", internalType: "uint24", type: "uint24" },
1236
+ { name: "tickSpacing", internalType: "int24", type: "int24" },
1237
+ {
1238
+ name: "hooks",
1239
+ internalType: "contract IHooks",
1240
+ type: "address"
1241
+ }
1242
+ ]
1243
+ },
1244
+ { name: "inputCurrency", internalType: "address", type: "address" },
1245
+ { name: "inputAmount", internalType: "uint256", type: "uint256" },
1246
+ { name: "minAmountOut", internalType: "uint256", type: "uint256" }
1247
+ ]
1248
+ }
1249
+ ],
1250
+ name: "encodeBuySupplyWithV4SwapHookData",
1251
+ outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1252
+ stateMutability: "pure"
1253
+ },
1197
1254
  {
1198
1255
  type: "function",
1199
1256
  inputs: [],
@@ -1203,6 +1260,15 @@ var buySupplyWithSwapRouterHookABI = [
1203
1260
  ],
1204
1261
  stateMutability: "view"
1205
1262
  },
1263
+ {
1264
+ type: "function",
1265
+ inputs: [],
1266
+ name: "poolManager",
1267
+ outputs: [
1268
+ { name: "", internalType: "contract IPoolManager", type: "address" }
1269
+ ],
1270
+ stateMutability: "view"
1271
+ },
1206
1272
  {
1207
1273
  type: "function",
1208
1274
  inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }],
@@ -1210,6 +1276,15 @@ var buySupplyWithSwapRouterHookABI = [
1210
1276
  outputs: [{ name: "", internalType: "bool", type: "bool" }],
1211
1277
  stateMutability: "pure"
1212
1278
  },
1279
+ {
1280
+ type: "function",
1281
+ inputs: [],
1282
+ name: "swapRouter",
1283
+ outputs: [
1284
+ { name: "", internalType: "contract ISwapRouter", type: "address" }
1285
+ ],
1286
+ stateMutability: "view"
1287
+ },
1213
1288
  {
1214
1289
  type: "function",
1215
1290
  inputs: [{ name: "data", internalType: "bytes", type: "bytes" }],
@@ -1217,6 +1292,58 @@ var buySupplyWithSwapRouterHookABI = [
1217
1292
  outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1218
1293
  stateMutability: "nonpayable"
1219
1294
  },
1295
+ {
1296
+ type: "event",
1297
+ anonymous: false,
1298
+ inputs: [
1299
+ { name: "coin", internalType: "address", type: "address", indexed: true },
1300
+ {
1301
+ name: "recipient",
1302
+ internalType: "address",
1303
+ type: "address",
1304
+ indexed: true
1305
+ },
1306
+ {
1307
+ name: "coinsPurchased",
1308
+ internalType: "uint256",
1309
+ type: "uint256",
1310
+ indexed: true
1311
+ },
1312
+ { name: "v3Route", internalType: "bytes", type: "bytes", indexed: false },
1313
+ {
1314
+ name: "v4Route",
1315
+ internalType: "struct PoolKey[]",
1316
+ type: "tuple[]",
1317
+ components: [
1318
+ { name: "currency0", internalType: "Currency", type: "address" },
1319
+ { name: "currency1", internalType: "Currency", type: "address" },
1320
+ { name: "fee", internalType: "uint24", type: "uint24" },
1321
+ { name: "tickSpacing", internalType: "int24", type: "int24" },
1322
+ { name: "hooks", internalType: "contract IHooks", type: "address" }
1323
+ ],
1324
+ indexed: false
1325
+ },
1326
+ {
1327
+ name: "inputCurrency",
1328
+ internalType: "address",
1329
+ type: "address",
1330
+ indexed: false
1331
+ },
1332
+ {
1333
+ name: "inputAmount",
1334
+ internalType: "uint256",
1335
+ type: "uint256",
1336
+ indexed: false
1337
+ },
1338
+ {
1339
+ name: "v4SwapInput",
1340
+ internalType: "uint256",
1341
+ type: "uint256",
1342
+ indexed: false
1343
+ }
1344
+ ],
1345
+ name: "BuyInitialSupply"
1346
+ },
1220
1347
  {
1221
1348
  type: "error",
1222
1349
  inputs: [{ name: "target", internalType: "address", type: "address" }],
@@ -1228,20 +1355,17 @@ var buySupplyWithSwapRouterHookABI = [
1228
1355
  name: "AddressInsufficientBalance"
1229
1356
  },
1230
1357
  { type: "error", inputs: [], name: "AddressZero" },
1358
+ { type: "error", inputs: [], name: "FailedInnerCall" },
1359
+ { type: "error", inputs: [], name: "HookNotImplemented" },
1231
1360
  {
1232
1361
  type: "error",
1233
- inputs: [{ name: "balance", internalType: "uint256", type: "uint256" }],
1234
- name: "CoinBalanceNot0"
1235
- },
1236
- {
1237
- type: "error",
1238
- inputs: [{ name: "balance", internalType: "uint256", type: "uint256" }],
1239
- name: "CurrencyBalanceNot0"
1362
+ inputs: [
1363
+ { name: "inputAmount", internalType: "uint256", type: "uint256" },
1364
+ { name: "availableAmount", internalType: "uint256", type: "uint256" }
1365
+ ],
1366
+ name: "InsufficientInputCurrency"
1240
1367
  },
1241
- { type: "error", inputs: [], name: "Erc20NotReceived" },
1242
- { type: "error", inputs: [], name: "FailedInnerCall" },
1243
- { type: "error", inputs: [], name: "HookNotImplemented" },
1244
- { type: "error", inputs: [], name: "InvalidSwapRouterCall" },
1368
+ { type: "error", inputs: [], name: "InsufficientOutputAmount" },
1245
1369
  { type: "error", inputs: [], name: "NotFactory" },
1246
1370
  { type: "error", inputs: [], name: "OnlyPoolManager" },
1247
1371
  {
@@ -1249,11 +1373,8 @@ var buySupplyWithSwapRouterHookABI = [
1249
1373
  inputs: [{ name: "token", internalType: "address", type: "address" }],
1250
1374
  name: "SafeERC20FailedOperation"
1251
1375
  },
1252
- {
1253
- type: "error",
1254
- inputs: [{ name: "error", internalType: "bytes", type: "bytes" }],
1255
- name: "SwapReverted"
1256
- }
1376
+ { type: "error", inputs: [], name: "V3RouteCannotStartWithInputCurrency" },
1377
+ { type: "error", inputs: [], name: "V3RouteDoesNotConnectToV4RouteStart" }
1257
1378
  ];
1258
1379
  var contentCoinABI = [
1259
1380
  {
@@ -4819,7 +4940,7 @@ var zoraFactoryImplABI = [
4819
4940
  export {
4820
4941
  autoSwapperABI,
4821
4942
  baseCoinABI,
4822
- buySupplyWithSwapRouterHookABI,
4943
+ buySupplyWithV4SwapHookABI,
4823
4944
  contentCoinABI,
4824
4945
  creatorCoinABI,
4825
4946
  iPermit2ABI,