@zoralabs/coins 2.2.1 → 2.3.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 (88) hide show
  1. package/.turbo/turbo-build$colon$js.log +125 -106
  2. package/CHANGELOG.md +50 -5
  3. package/README.md +5 -0
  4. package/abis/AddressConstants.json +7 -0
  5. package/abis/BaseCoin.json +0 -5
  6. package/abis/BaseTest.json +62 -0
  7. package/abis/BuySupplyWithV4SwapHook.json +429 -0
  8. package/abis/ContentCoin.json +0 -5
  9. package/abis/CreatorCoin.json +0 -5
  10. package/abis/FeeEstimatorHook.json +94 -1
  11. package/abis/IUniswapV4Router04.json +484 -0
  12. package/abis/IUpgradeableDestinationV4HookWithUpdateableFee.json +95 -0
  13. package/abis/IZoraFactory.json +69 -0
  14. package/abis/MockAirlock.json +39 -0
  15. package/abis/SimpleERC20.json +326 -0
  16. package/abis/ZoraFactoryImpl.json +69 -0
  17. package/abis/ZoraV4CoinHook.json +94 -1
  18. package/addresses/8453.json +8 -10
  19. package/audits/report-cantinacode-zora-0827.pdf +3498 -4
  20. package/audits/report-cantinacode-zora-1021.pdf +0 -0
  21. package/dist/index.cjs +161 -22
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.js +160 -21
  24. package/dist/index.js.map +1 -1
  25. package/dist/wagmiGenerated.d.ts +259 -40
  26. package/dist/wagmiGenerated.d.ts.map +1 -1
  27. package/foundry.toml +3 -3
  28. package/package/wagmiGenerated.ts +160 -21
  29. package/package.json +1 -1
  30. package/script/DeployPostDeploymentHooks.s.sol +1 -3
  31. package/script/TestBackingCoinSwap.s.sol +0 -2
  32. package/script/TestV4Swap.s.sol +0 -2
  33. package/src/BaseCoin.sol +4 -12
  34. package/src/ContentCoin.sol +3 -4
  35. package/src/CreatorCoin.sol +8 -10
  36. package/src/ZoraFactoryImpl.sol +115 -83
  37. package/src/deployment/CoinsDeployerBase.sol +9 -8
  38. package/src/hook-registry/ZoraHookRegistry.sol +4 -0
  39. package/src/hooks/ZoraV4CoinHook.sol +66 -9
  40. package/src/hooks/deployment/BuySupplyWithV4SwapHook.sol +310 -0
  41. package/src/interfaces/IUpgradeableV4Hook.sol +18 -0
  42. package/src/interfaces/IZoraFactory.sol +21 -2
  43. package/src/libs/CoinConstants.sol +51 -8
  44. package/src/libs/CoinDopplerMultiCurve.sol +11 -11
  45. package/src/libs/CoinRewardsV4.sol +26 -33
  46. package/src/libs/CoinSetup.sol +2 -9
  47. package/src/libs/DopplerMath.sol +2 -2
  48. package/src/libs/V4Liquidity.sol +79 -15
  49. package/src/utils/AutoSwapper.sol +1 -1
  50. package/src/version/ContractVersionBase.sol +1 -1
  51. package/test/BuySupplyWithV4SwapHook.t.sol +509 -0
  52. package/test/Coin.t.sol +26 -14
  53. package/test/CoinRewardsV4.t.sol +33 -0
  54. package/test/CoinUniV4.t.sol +3 -5
  55. package/test/ContentCoinRewards.t.sol +44 -3
  56. package/test/CreatorCoin.t.sol +54 -33
  57. package/test/CreatorCoinRewards.t.sol +1 -3
  58. package/test/DeploymentHooks.t.sol +54 -2
  59. package/test/Factory.t.sol +3 -3
  60. package/test/LiquidityMigration.t.sol +145 -7
  61. package/test/MultiOwnable.t.sol +4 -4
  62. package/test/Upgrades.t.sol +26 -17
  63. package/test/V4Liquidity.t.sol +178 -0
  64. package/test/ZoraHookRegistry.t.sol +19 -9
  65. package/test/mocks/MockAirlock.sol +22 -0
  66. package/test/mocks/SimpleERC20.sol +8 -0
  67. package/test/utils/BaseTest.sol +155 -3
  68. package/test/utils/RewardTestHelpers.sol +4 -4
  69. package/test/utils/hookmate/README.md +50 -0
  70. package/test/utils/hookmate/artifacts/DeployHelper.sol +20 -0
  71. package/test/utils/hookmate/artifacts/Permit2.sol +16 -0
  72. package/test/utils/hookmate/artifacts/UniversalRouter.sol +29 -0
  73. package/test/utils/hookmate/artifacts/V4PoolManager.sol +17 -0
  74. package/test/utils/hookmate/artifacts/V4PositionManager.sol +23 -0
  75. package/test/utils/hookmate/artifacts/V4Quoter.sol +17 -0
  76. package/test/utils/hookmate/artifacts/V4Router.sol +18 -0
  77. package/test/utils/hookmate/constants/AddressConstants.sol +193 -0
  78. package/test/utils/hookmate/interfaces/router/IUniswapV4Router04.sol +173 -0
  79. package/test/utils/hookmate/interfaces/router/PathKey.sol +34 -0
  80. package/test/utils/hookmate/test/utils/SwapFeeEventAsserter.sol +24 -0
  81. package/wagmi.config.ts +1 -1
  82. package/abis/CoinConstants.json +0 -54
  83. package/abis/CoinRewardsV4.json +0 -67
  84. package/src/libs/CreatorCoinConstants.sol +0 -15
  85. package/src/libs/MarketConstants.sol +0 -23
  86. package/src/utils/uniswap/BytesLib.sol +0 -35
  87. package/src/utils/uniswap/Path.sol +0 -31
  88. /package/abis/{VmContractHelper227.json → VmContractHelper239.json} +0 -0
package/dist/index.cjs CHANGED
@@ -22,7 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  autoSwapperABI: () => autoSwapperABI,
24
24
  baseCoinABI: () => baseCoinABI,
25
- buySupplyWithSwapRouterHookABI: () => buySupplyWithSwapRouterHookABI,
25
+ buySupplyWithV4SwapHookABI: () => buySupplyWithV4SwapHookABI,
26
26
  contentCoinABI: () => contentCoinABI,
27
27
  creatorCoinABI: () => creatorCoinABI,
28
28
  iPermit2ABI: () => iPermit2ABI,
@@ -1201,11 +1201,10 @@ var baseCoinABI = [
1201
1201
  },
1202
1202
  { type: "error", inputs: [], name: "OnlyWeth" },
1203
1203
  { type: "error", inputs: [], name: "OwnerCannotBeAddressZero" },
1204
- { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" },
1205
1204
  { type: "error", inputs: [], name: "SlippageBoundsExceeded" },
1206
1205
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
1207
1206
  ];
1208
- var buySupplyWithSwapRouterHookABI = [
1207
+ var buySupplyWithV4SwapHookABI = [
1209
1208
  {
1210
1209
  type: "constructor",
1211
1210
  inputs: [
@@ -1230,6 +1229,63 @@ var buySupplyWithSwapRouterHookABI = [
1230
1229
  outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1231
1230
  stateMutability: "payable"
1232
1231
  },
1232
+ {
1233
+ type: "function",
1234
+ inputs: [{ name: "data", internalType: "bytes", type: "bytes" }],
1235
+ name: "decodeV4RouteData",
1236
+ outputs: [
1237
+ {
1238
+ name: "v4Route",
1239
+ internalType: "struct PoolKey[]",
1240
+ type: "tuple[]",
1241
+ components: [
1242
+ { name: "currency0", internalType: "Currency", type: "address" },
1243
+ { name: "currency1", internalType: "Currency", type: "address" },
1244
+ { name: "fee", internalType: "uint24", type: "uint24" },
1245
+ { name: "tickSpacing", internalType: "int24", type: "int24" },
1246
+ { name: "hooks", internalType: "contract IHooks", type: "address" }
1247
+ ]
1248
+ },
1249
+ { name: "startAmount", internalType: "uint256", type: "uint256" }
1250
+ ],
1251
+ stateMutability: "pure"
1252
+ },
1253
+ {
1254
+ type: "function",
1255
+ inputs: [
1256
+ {
1257
+ name: "params",
1258
+ internalType: "struct BuySupplyWithV4SwapHook.InitialSupplyParams",
1259
+ type: "tuple",
1260
+ components: [
1261
+ { name: "buyRecipient", internalType: "address", type: "address" },
1262
+ { name: "v3Route", internalType: "bytes", type: "bytes" },
1263
+ {
1264
+ name: "v4Route",
1265
+ internalType: "struct PoolKey[]",
1266
+ type: "tuple[]",
1267
+ components: [
1268
+ { name: "currency0", internalType: "Currency", type: "address" },
1269
+ { name: "currency1", internalType: "Currency", type: "address" },
1270
+ { name: "fee", internalType: "uint24", type: "uint24" },
1271
+ { name: "tickSpacing", internalType: "int24", type: "int24" },
1272
+ {
1273
+ name: "hooks",
1274
+ internalType: "contract IHooks",
1275
+ type: "address"
1276
+ }
1277
+ ]
1278
+ },
1279
+ { name: "inputCurrency", internalType: "address", type: "address" },
1280
+ { name: "inputAmount", internalType: "uint256", type: "uint256" },
1281
+ { name: "minAmountOut", internalType: "uint256", type: "uint256" }
1282
+ ]
1283
+ }
1284
+ ],
1285
+ name: "encodeBuySupplyWithV4SwapHookData",
1286
+ outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1287
+ stateMutability: "pure"
1288
+ },
1233
1289
  {
1234
1290
  type: "function",
1235
1291
  inputs: [],
@@ -1239,6 +1295,15 @@ var buySupplyWithSwapRouterHookABI = [
1239
1295
  ],
1240
1296
  stateMutability: "view"
1241
1297
  },
1298
+ {
1299
+ type: "function",
1300
+ inputs: [],
1301
+ name: "poolManager",
1302
+ outputs: [
1303
+ { name: "", internalType: "contract IPoolManager", type: "address" }
1304
+ ],
1305
+ stateMutability: "view"
1306
+ },
1242
1307
  {
1243
1308
  type: "function",
1244
1309
  inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }],
@@ -1246,6 +1311,15 @@ var buySupplyWithSwapRouterHookABI = [
1246
1311
  outputs: [{ name: "", internalType: "bool", type: "bool" }],
1247
1312
  stateMutability: "pure"
1248
1313
  },
1314
+ {
1315
+ type: "function",
1316
+ inputs: [],
1317
+ name: "swapRouter",
1318
+ outputs: [
1319
+ { name: "", internalType: "contract ISwapRouter", type: "address" }
1320
+ ],
1321
+ stateMutability: "view"
1322
+ },
1249
1323
  {
1250
1324
  type: "function",
1251
1325
  inputs: [{ name: "data", internalType: "bytes", type: "bytes" }],
@@ -1253,6 +1327,58 @@ var buySupplyWithSwapRouterHookABI = [
1253
1327
  outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1254
1328
  stateMutability: "nonpayable"
1255
1329
  },
1330
+ {
1331
+ type: "event",
1332
+ anonymous: false,
1333
+ inputs: [
1334
+ { name: "coin", internalType: "address", type: "address", indexed: true },
1335
+ {
1336
+ name: "recipient",
1337
+ internalType: "address",
1338
+ type: "address",
1339
+ indexed: true
1340
+ },
1341
+ {
1342
+ name: "coinsPurchased",
1343
+ internalType: "uint256",
1344
+ type: "uint256",
1345
+ indexed: true
1346
+ },
1347
+ { name: "v3Route", internalType: "bytes", type: "bytes", indexed: false },
1348
+ {
1349
+ name: "v4Route",
1350
+ internalType: "struct PoolKey[]",
1351
+ type: "tuple[]",
1352
+ components: [
1353
+ { name: "currency0", internalType: "Currency", type: "address" },
1354
+ { name: "currency1", internalType: "Currency", type: "address" },
1355
+ { name: "fee", internalType: "uint24", type: "uint24" },
1356
+ { name: "tickSpacing", internalType: "int24", type: "int24" },
1357
+ { name: "hooks", internalType: "contract IHooks", type: "address" }
1358
+ ],
1359
+ indexed: false
1360
+ },
1361
+ {
1362
+ name: "inputCurrency",
1363
+ internalType: "address",
1364
+ type: "address",
1365
+ indexed: false
1366
+ },
1367
+ {
1368
+ name: "inputAmount",
1369
+ internalType: "uint256",
1370
+ type: "uint256",
1371
+ indexed: false
1372
+ },
1373
+ {
1374
+ name: "v4SwapInput",
1375
+ internalType: "uint256",
1376
+ type: "uint256",
1377
+ indexed: false
1378
+ }
1379
+ ],
1380
+ name: "BuyInitialSupply"
1381
+ },
1256
1382
  {
1257
1383
  type: "error",
1258
1384
  inputs: [{ name: "target", internalType: "address", type: "address" }],
@@ -1264,20 +1390,17 @@ var buySupplyWithSwapRouterHookABI = [
1264
1390
  name: "AddressInsufficientBalance"
1265
1391
  },
1266
1392
  { type: "error", inputs: [], name: "AddressZero" },
1393
+ { type: "error", inputs: [], name: "FailedInnerCall" },
1394
+ { type: "error", inputs: [], name: "HookNotImplemented" },
1267
1395
  {
1268
1396
  type: "error",
1269
- inputs: [{ name: "balance", internalType: "uint256", type: "uint256" }],
1270
- name: "CoinBalanceNot0"
1271
- },
1272
- {
1273
- type: "error",
1274
- inputs: [{ name: "balance", internalType: "uint256", type: "uint256" }],
1275
- name: "CurrencyBalanceNot0"
1397
+ inputs: [
1398
+ { name: "inputAmount", internalType: "uint256", type: "uint256" },
1399
+ { name: "availableAmount", internalType: "uint256", type: "uint256" }
1400
+ ],
1401
+ name: "InsufficientInputCurrency"
1276
1402
  },
1277
- { type: "error", inputs: [], name: "Erc20NotReceived" },
1278
- { type: "error", inputs: [], name: "FailedInnerCall" },
1279
- { type: "error", inputs: [], name: "HookNotImplemented" },
1280
- { type: "error", inputs: [], name: "InvalidSwapRouterCall" },
1403
+ { type: "error", inputs: [], name: "InsufficientOutputAmount" },
1281
1404
  { type: "error", inputs: [], name: "NotFactory" },
1282
1405
  { type: "error", inputs: [], name: "OnlyPoolManager" },
1283
1406
  {
@@ -1285,11 +1408,8 @@ var buySupplyWithSwapRouterHookABI = [
1285
1408
  inputs: [{ name: "token", internalType: "address", type: "address" }],
1286
1409
  name: "SafeERC20FailedOperation"
1287
1410
  },
1288
- {
1289
- type: "error",
1290
- inputs: [{ name: "error", internalType: "bytes", type: "bytes" }],
1291
- name: "SwapReverted"
1292
- }
1411
+ { type: "error", inputs: [], name: "V3RouteCannotStartWithInputCurrency" },
1412
+ { type: "error", inputs: [], name: "V3RouteDoesNotConnectToV4RouteStart" }
1293
1413
  ];
1294
1414
  var contentCoinABI = [
1295
1415
  {
@@ -2384,7 +2504,6 @@ var contentCoinABI = [
2384
2504
  },
2385
2505
  { type: "error", inputs: [], name: "OnlyWeth" },
2386
2506
  { type: "error", inputs: [], name: "OwnerCannotBeAddressZero" },
2387
- { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" },
2388
2507
  { type: "error", inputs: [], name: "SlippageBoundsExceeded" },
2389
2508
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
2390
2509
  ];
@@ -3554,7 +3673,6 @@ var creatorCoinABI = [
3554
3673
  },
3555
3674
  { type: "error", inputs: [], name: "OnlyWeth" },
3556
3675
  { type: "error", inputs: [], name: "OwnerCannotBeAddressZero" },
3557
- { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" },
3558
3676
  { type: "error", inputs: [], name: "SlippageBoundsExceeded" },
3559
3677
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
3560
3678
  ];
@@ -4401,6 +4519,27 @@ var zoraFactoryImplABI = [
4401
4519
  outputs: [{ name: "", internalType: "address", type: "address" }],
4402
4520
  stateMutability: "nonpayable"
4403
4521
  },
4522
+ {
4523
+ type: "function",
4524
+ inputs: [
4525
+ { name: "payoutRecipient", internalType: "address", type: "address" },
4526
+ { name: "owners", internalType: "address[]", type: "address[]" },
4527
+ { name: "uri", internalType: "string", type: "string" },
4528
+ { name: "name", internalType: "string", type: "string" },
4529
+ { name: "symbol", internalType: "string", type: "string" },
4530
+ { name: "poolConfig", internalType: "bytes", type: "bytes" },
4531
+ { name: "platformReferrer", internalType: "address", type: "address" },
4532
+ { name: "postDeployHook", internalType: "address", type: "address" },
4533
+ { name: "postDeployHookData", internalType: "bytes", type: "bytes" },
4534
+ { name: "coinSalt", internalType: "bytes32", type: "bytes32" }
4535
+ ],
4536
+ name: "deployCreatorCoin",
4537
+ outputs: [
4538
+ { name: "coin", internalType: "address", type: "address" },
4539
+ { name: "postDeployHookDataOut", internalType: "bytes", type: "bytes" }
4540
+ ],
4541
+ stateMutability: "payable"
4542
+ },
4404
4543
  {
4405
4544
  type: "function",
4406
4545
  inputs: [
@@ -4837,7 +4976,7 @@ var zoraFactoryImplABI = [
4837
4976
  0 && (module.exports = {
4838
4977
  autoSwapperABI,
4839
4978
  baseCoinABI,
4840
- buySupplyWithSwapRouterHookABI,
4979
+ buySupplyWithV4SwapHookABI,
4841
4980
  contentCoinABI,
4842
4981
  creatorCoinABI,
4843
4982
  iPermit2ABI,