@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.js CHANGED
@@ -1166,11 +1166,10 @@ var baseCoinABI = [
1166
1166
  },
1167
1167
  { type: "error", inputs: [], name: "OnlyWeth" },
1168
1168
  { type: "error", inputs: [], name: "OwnerCannotBeAddressZero" },
1169
- { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" },
1170
1169
  { type: "error", inputs: [], name: "SlippageBoundsExceeded" },
1171
1170
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
1172
1171
  ];
1173
- var buySupplyWithSwapRouterHookABI = [
1172
+ var buySupplyWithV4SwapHookABI = [
1174
1173
  {
1175
1174
  type: "constructor",
1176
1175
  inputs: [
@@ -1195,6 +1194,63 @@ var buySupplyWithSwapRouterHookABI = [
1195
1194
  outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1196
1195
  stateMutability: "payable"
1197
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
+ },
1198
1254
  {
1199
1255
  type: "function",
1200
1256
  inputs: [],
@@ -1204,6 +1260,15 @@ var buySupplyWithSwapRouterHookABI = [
1204
1260
  ],
1205
1261
  stateMutability: "view"
1206
1262
  },
1263
+ {
1264
+ type: "function",
1265
+ inputs: [],
1266
+ name: "poolManager",
1267
+ outputs: [
1268
+ { name: "", internalType: "contract IPoolManager", type: "address" }
1269
+ ],
1270
+ stateMutability: "view"
1271
+ },
1207
1272
  {
1208
1273
  type: "function",
1209
1274
  inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }],
@@ -1211,6 +1276,15 @@ var buySupplyWithSwapRouterHookABI = [
1211
1276
  outputs: [{ name: "", internalType: "bool", type: "bool" }],
1212
1277
  stateMutability: "pure"
1213
1278
  },
1279
+ {
1280
+ type: "function",
1281
+ inputs: [],
1282
+ name: "swapRouter",
1283
+ outputs: [
1284
+ { name: "", internalType: "contract ISwapRouter", type: "address" }
1285
+ ],
1286
+ stateMutability: "view"
1287
+ },
1214
1288
  {
1215
1289
  type: "function",
1216
1290
  inputs: [{ name: "data", internalType: "bytes", type: "bytes" }],
@@ -1218,6 +1292,58 @@ var buySupplyWithSwapRouterHookABI = [
1218
1292
  outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
1219
1293
  stateMutability: "nonpayable"
1220
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
+ },
1221
1347
  {
1222
1348
  type: "error",
1223
1349
  inputs: [{ name: "target", internalType: "address", type: "address" }],
@@ -1229,20 +1355,17 @@ var buySupplyWithSwapRouterHookABI = [
1229
1355
  name: "AddressInsufficientBalance"
1230
1356
  },
1231
1357
  { type: "error", inputs: [], name: "AddressZero" },
1358
+ { type: "error", inputs: [], name: "FailedInnerCall" },
1359
+ { type: "error", inputs: [], name: "HookNotImplemented" },
1232
1360
  {
1233
1361
  type: "error",
1234
- inputs: [{ name: "balance", internalType: "uint256", type: "uint256" }],
1235
- name: "CoinBalanceNot0"
1236
- },
1237
- {
1238
- type: "error",
1239
- inputs: [{ name: "balance", internalType: "uint256", type: "uint256" }],
1240
- name: "CurrencyBalanceNot0"
1362
+ inputs: [
1363
+ { name: "inputAmount", internalType: "uint256", type: "uint256" },
1364
+ { name: "availableAmount", internalType: "uint256", type: "uint256" }
1365
+ ],
1366
+ name: "InsufficientInputCurrency"
1241
1367
  },
1242
- { type: "error", inputs: [], name: "Erc20NotReceived" },
1243
- { type: "error", inputs: [], name: "FailedInnerCall" },
1244
- { type: "error", inputs: [], name: "HookNotImplemented" },
1245
- { type: "error", inputs: [], name: "InvalidSwapRouterCall" },
1368
+ { type: "error", inputs: [], name: "InsufficientOutputAmount" },
1246
1369
  { type: "error", inputs: [], name: "NotFactory" },
1247
1370
  { type: "error", inputs: [], name: "OnlyPoolManager" },
1248
1371
  {
@@ -1250,11 +1373,8 @@ var buySupplyWithSwapRouterHookABI = [
1250
1373
  inputs: [{ name: "token", internalType: "address", type: "address" }],
1251
1374
  name: "SafeERC20FailedOperation"
1252
1375
  },
1253
- {
1254
- type: "error",
1255
- inputs: [{ name: "error", internalType: "bytes", type: "bytes" }],
1256
- name: "SwapReverted"
1257
- }
1376
+ { type: "error", inputs: [], name: "V3RouteCannotStartWithInputCurrency" },
1377
+ { type: "error", inputs: [], name: "V3RouteDoesNotConnectToV4RouteStart" }
1258
1378
  ];
1259
1379
  var contentCoinABI = [
1260
1380
  {
@@ -2349,7 +2469,6 @@ var contentCoinABI = [
2349
2469
  },
2350
2470
  { type: "error", inputs: [], name: "OnlyWeth" },
2351
2471
  { type: "error", inputs: [], name: "OwnerCannotBeAddressZero" },
2352
- { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" },
2353
2472
  { type: "error", inputs: [], name: "SlippageBoundsExceeded" },
2354
2473
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
2355
2474
  ];
@@ -3519,7 +3638,6 @@ var creatorCoinABI = [
3519
3638
  },
3520
3639
  { type: "error", inputs: [], name: "OnlyWeth" },
3521
3640
  { type: "error", inputs: [], name: "OwnerCannotBeAddressZero" },
3522
- { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" },
3523
3641
  { type: "error", inputs: [], name: "SlippageBoundsExceeded" },
3524
3642
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
3525
3643
  ];
@@ -4366,6 +4484,27 @@ var zoraFactoryImplABI = [
4366
4484
  outputs: [{ name: "", internalType: "address", type: "address" }],
4367
4485
  stateMutability: "nonpayable"
4368
4486
  },
4487
+ {
4488
+ type: "function",
4489
+ inputs: [
4490
+ { name: "payoutRecipient", internalType: "address", type: "address" },
4491
+ { name: "owners", internalType: "address[]", type: "address[]" },
4492
+ { name: "uri", internalType: "string", type: "string" },
4493
+ { name: "name", internalType: "string", type: "string" },
4494
+ { name: "symbol", internalType: "string", type: "string" },
4495
+ { name: "poolConfig", internalType: "bytes", type: "bytes" },
4496
+ { name: "platformReferrer", internalType: "address", type: "address" },
4497
+ { name: "postDeployHook", internalType: "address", type: "address" },
4498
+ { name: "postDeployHookData", internalType: "bytes", type: "bytes" },
4499
+ { name: "coinSalt", internalType: "bytes32", type: "bytes32" }
4500
+ ],
4501
+ name: "deployCreatorCoin",
4502
+ outputs: [
4503
+ { name: "coin", internalType: "address", type: "address" },
4504
+ { name: "postDeployHookDataOut", internalType: "bytes", type: "bytes" }
4505
+ ],
4506
+ stateMutability: "payable"
4507
+ },
4369
4508
  {
4370
4509
  type: "function",
4371
4510
  inputs: [
@@ -4801,7 +4940,7 @@ var zoraFactoryImplABI = [
4801
4940
  export {
4802
4941
  autoSwapperABI,
4803
4942
  baseCoinABI,
4804
- buySupplyWithSwapRouterHookABI,
4943
+ buySupplyWithV4SwapHookABI,
4805
4944
  contentCoinABI,
4806
4945
  creatorCoinABI,
4807
4946
  iPermit2ABI,