@zoralabs/coins 0.7.1 → 0.9.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 (104) hide show
  1. package/.env +1 -0
  2. package/.turbo/turbo-build.log +114 -109
  3. package/.turbo/turbo-update-contract-version.log +22 -0
  4. package/CHANGELOG.md +28 -0
  5. package/abis/BadImpl.json +15 -0
  6. package/abis/BalanceDeltaLibrary.json +15 -0
  7. package/abis/BaseCoin.json +1442 -0
  8. package/abis/BaseCoinDeployHook.json +78 -0
  9. package/abis/BaseHook.json +897 -0
  10. package/abis/BaseTest.json +13 -91
  11. package/abis/BeforeSwapDeltaLibrary.json +15 -0
  12. package/abis/BuySupplyWithSwapRouterHook.json +126 -0
  13. package/abis/Coin.json +48 -92
  14. package/abis/CoinConstants.json +65 -0
  15. package/abis/CoinTest.json +13 -91
  16. package/abis/CoinV4.json +1664 -0
  17. package/abis/CurrencyLibrary.json +25 -0
  18. package/abis/DeployHooks.json +9 -0
  19. package/abis/DopplerUniswapV3Test.json +13 -91
  20. package/abis/FactoryTest.json +13 -91
  21. package/abis/FakeHookNoInterface.json +21 -0
  22. package/abis/HookDeployer.json +68 -0
  23. package/abis/Hooks.json +28 -0
  24. package/abis/HooksTest.json +651 -0
  25. package/abis/IAllowanceTransfer.json +486 -0
  26. package/abis/ICoin.json +25 -1
  27. package/abis/ICoinDeployHook.json +31 -0
  28. package/abis/IContractMetadata.json +28 -0
  29. package/abis/IEIP712.json +15 -0
  30. package/abis/IEIP712_v4.json +15 -0
  31. package/abis/IERC20Minimal.json +172 -0
  32. package/abis/IERC6909Claims.json +288 -0
  33. package/abis/IERC721Permit_v4.json +88 -0
  34. package/abis/IExtsload.json +64 -0
  35. package/abis/IExttload.json +40 -0
  36. package/abis/IHasAfterCoinDeploy.json +31 -0
  37. package/abis/IHasContractName.json +15 -0
  38. package/abis/IHookDeployer.json +42 -0
  39. package/abis/IHooks.json +789 -0
  40. package/abis/IImmutableState.json +15 -0
  41. package/abis/IMulticall_v4.json +21 -0
  42. package/abis/INotifier.json +187 -0
  43. package/abis/IPermit2.json +865 -0
  44. package/abis/IPermit2Forwarder.json +138 -0
  45. package/abis/IPoolInitializer_v4.json +53 -0
  46. package/abis/IPoolManager.json +1286 -0
  47. package/abis/IPositionManager.json +712 -0
  48. package/abis/IProtocolFees.json +174 -0
  49. package/abis/ISignatureTransfer.json +394 -0
  50. package/abis/ISubscriber.json +89 -0
  51. package/abis/ISwapRouter.json +82 -0
  52. package/abis/IUnorderedNonce.json +44 -0
  53. package/abis/IV4Router.json +47 -0
  54. package/abis/IZoraFactory.json +144 -0
  55. package/abis/IZoraV4CoinHook.json +83 -0
  56. package/abis/ImmutableState.json +36 -0
  57. package/abis/LPFeeLibrary.json +65 -0
  58. package/abis/MultiOwnableTest.json +13 -91
  59. package/abis/Simulate.json +0 -91
  60. package/abis/UniV3BuySell.json +12 -0
  61. package/abis/UniV3Errors.json +32 -0
  62. package/abis/UpgradeFactoryImpl.json +9 -0
  63. package/abis/UpgradesTest.json +604 -0
  64. package/abis/ZoraFactoryImpl.json +111 -0
  65. package/abis/ZoraV4CoinHook.json +989 -0
  66. package/addresses/8453.json +2 -1
  67. package/addresses/84532.json +4 -3
  68. package/dist/index.cjs +125 -62
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.js +120 -56
  71. package/dist/index.js.map +1 -1
  72. package/dist/wagmiGenerated.d.ts +212 -464
  73. package/dist/wagmiGenerated.d.ts.map +1 -1
  74. package/package/wagmiGenerated.ts +122 -66
  75. package/package.json +4 -4
  76. package/script/CoinsDeployerBase.sol +32 -0
  77. package/script/DeployHooks.s.sol +22 -0
  78. package/script/Simulate.s.sol +3 -2
  79. package/script/UpgradeCoinImpl.sol +2 -2
  80. package/script/UpgradeFactoryImpl.s.sol +23 -0
  81. package/src/Coin.sol +35 -342
  82. package/src/ZoraFactoryImpl.sol +73 -45
  83. package/src/hooks/BaseCoinDeployHook.sol +62 -0
  84. package/src/hooks/BuySupplyWithSwapRouterHook.sol +78 -0
  85. package/src/interfaces/ICoin.sol +5 -1
  86. package/src/interfaces/ICoinDeployHook.sol +8 -0
  87. package/src/interfaces/ISwapRouter.sol +1 -35
  88. package/src/interfaces/IZoraFactory.sol +52 -0
  89. package/src/{utils → libs}/CoinConstants.sol +6 -6
  90. package/src/libs/CoinLegacy.sol +4 -4
  91. package/src/libs/CoinLegacyMarket.sol +182 -0
  92. package/src/libs/CoinSetupV3.sol +111 -0
  93. package/src/libs/UniV3BuySell.sol +449 -0
  94. package/src/libs/UniV3Errors.sol +11 -0
  95. package/src/version/ContractVersionBase.sol +1 -1
  96. package/test/Coin.t.sol +20 -17
  97. package/test/CoinDopplerUniV3.t.sol +7 -17
  98. package/test/Factory.t.sol +4 -3
  99. package/test/Hooks.t.sol +274 -0
  100. package/test/Upgrades.t.sol +67 -0
  101. package/test/utils/BaseTest.sol +18 -3
  102. package/wagmi.config.ts +6 -9
  103. package/src/libs/CoinSetup.sol +0 -37
  104. /package/abis/{CoinSetup.json → CoinSetupV3.json} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"wagmiGenerated.d.ts","sourceRoot":"","sources":["../package/wagmiGenerated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgTrB,CAAA"}
@@ -1,79 +1,91 @@
1
1
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
- // Coin
2
+ // BuySupplyWithSwapRouterHook
3
3
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4
4
 
5
- export const coinABI = [
5
+ export const buySupplyWithSwapRouterHookABI = [
6
6
  {
7
7
  type: 'constructor',
8
8
  inputs: [
9
9
  {
10
- name: '_protocolRewardRecipient',
11
- internalType: 'address',
10
+ name: '_factory',
11
+ internalType: 'contract IZoraFactory',
12
12
  type: 'address',
13
13
  },
14
- { name: '_protocolRewards', internalType: 'address', type: 'address' },
15
- { name: '_weth', internalType: 'address', type: 'address' },
16
- { name: '_v3Factory', internalType: 'address', type: 'address' },
17
14
  { name: '_swapRouter', internalType: 'address', type: 'address' },
18
- { name: '_airlock', internalType: 'address', type: 'address' },
19
15
  ],
20
16
  stateMutability: 'nonpayable',
21
17
  },
22
- { type: 'receive', stateMutability: 'payable' },
23
- {
24
- type: 'function',
25
- inputs: [],
26
- name: 'DOMAIN_SEPARATOR',
27
- outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
28
- stateMutability: 'view',
29
- },
30
18
  {
31
19
  type: 'function',
32
- inputs: [],
33
- name: 'MAX_TOTAL_SUPPLY',
34
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
35
- stateMutability: 'view',
20
+ inputs: [
21
+ { name: 'sender', internalType: 'address', type: 'address' },
22
+ { name: 'coin', internalType: 'contract ICoin', type: 'address' },
23
+ { name: 'hookData', internalType: 'bytes', type: 'bytes' },
24
+ ],
25
+ name: 'afterCoinDeploy',
26
+ outputs: [{ name: '', internalType: 'bytes', type: 'bytes' }],
27
+ stateMutability: 'payable',
36
28
  },
37
29
  {
38
30
  type: 'function',
39
31
  inputs: [],
40
- name: 'MIN_ORDER_SIZE',
41
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
32
+ name: 'factory',
33
+ outputs: [
34
+ { name: '', internalType: 'contract IZoraFactory', type: 'address' },
35
+ ],
42
36
  stateMutability: 'view',
43
37
  },
44
38
  {
45
39
  type: 'function',
46
- inputs: [],
47
- name: 'PLATFORM_REFERRER_FEE_BPS',
48
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
49
- stateMutability: 'view',
40
+ inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }],
41
+ name: 'supportsInterface',
42
+ outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
43
+ stateMutability: 'pure',
50
44
  },
45
+ { type: 'error', inputs: [], name: 'AddressZero' },
51
46
  {
52
- type: 'function',
53
- inputs: [],
54
- name: 'PROTOCOL_FEE_BPS',
55
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
56
- stateMutability: 'view',
47
+ type: 'error',
48
+ inputs: [{ name: 'balance', internalType: 'uint256', type: 'uint256' }],
49
+ name: 'CoinBalanceNot0',
57
50
  },
51
+ { type: 'error', inputs: [], name: 'Erc20NotReceived' },
52
+ { type: 'error', inputs: [], name: 'HookNotImplemented' },
53
+ { type: 'error', inputs: [], name: 'InvalidSwapRouterCall' },
54
+ { type: 'error', inputs: [], name: 'NotFactory' },
58
55
  {
59
- type: 'function',
60
- inputs: [],
61
- name: 'TOKEN_CREATOR_FEE_BPS',
62
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
63
- stateMutability: 'view',
56
+ type: 'error',
57
+ inputs: [{ name: 'error', internalType: 'bytes', type: 'bytes' }],
58
+ name: 'SwapReverted',
64
59
  },
60
+ ] as const
61
+
62
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
63
+ // Coin
64
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
65
+
66
+ export const coinABI = [
65
67
  {
66
- type: 'function',
67
- inputs: [],
68
- name: 'TOTAL_FEE_BPS',
69
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
70
- stateMutability: 'view',
68
+ type: 'constructor',
69
+ inputs: [
70
+ {
71
+ name: '_protocolRewardRecipient',
72
+ internalType: 'address',
73
+ type: 'address',
74
+ },
75
+ { name: '_protocolRewards', internalType: 'address', type: 'address' },
76
+ { name: '_weth', internalType: 'address', type: 'address' },
77
+ { name: '_v3Factory', internalType: 'address', type: 'address' },
78
+ { name: '_swapRouter', internalType: 'address', type: 'address' },
79
+ { name: '_airlock', internalType: 'address', type: 'address' },
80
+ ],
81
+ stateMutability: 'nonpayable',
71
82
  },
83
+ { type: 'receive', stateMutability: 'payable' },
72
84
  {
73
85
  type: 'function',
74
86
  inputs: [],
75
- name: 'TRADE_REFERRER_FEE_BPS',
76
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
87
+ name: 'DOMAIN_SEPARATOR',
88
+ outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
77
89
  stateMutability: 'view',
78
90
  },
79
91
  {
@@ -228,6 +240,20 @@ export const coinABI = [
228
240
  outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
229
241
  stateMutability: 'view',
230
242
  },
243
+ {
244
+ type: 'function',
245
+ inputs: [],
246
+ name: 'market',
247
+ outputs: [{ name: '', internalType: 'bytes', type: 'bytes' }],
248
+ stateMutability: 'view',
249
+ },
250
+ {
251
+ type: 'function',
252
+ inputs: [],
253
+ name: 'marketVersion',
254
+ outputs: [{ name: '', internalType: 'uint8', type: 'uint8' }],
255
+ stateMutability: 'view',
256
+ },
231
257
  {
232
258
  type: 'function',
233
259
  inputs: [],
@@ -873,6 +899,7 @@ export const coinABI = [
873
899
  name: 'AddressInsufficientBalance',
874
900
  },
875
901
  { type: 'error', inputs: [], name: 'AddressZero' },
902
+ { type: 'error', inputs: [], name: 'AddressZero' },
876
903
  { type: 'error', inputs: [], name: 'AlreadyOwner' },
877
904
  { type: 'error', inputs: [], name: 'CannotMintZeroLiquidity' },
878
905
  {
@@ -963,6 +990,7 @@ export const coinABI = [
963
990
  { type: 'error', inputs: [], name: 'InvalidInitialization' },
964
991
  { type: 'error', inputs: [], name: 'InvalidMarketType' },
965
992
  { type: 'error', inputs: [], name: 'InvalidPoolVersion' },
993
+ { type: 'error', inputs: [], name: 'InvalidPoolVersion' },
966
994
  {
967
995
  type: 'error',
968
996
  inputs: [
@@ -988,7 +1016,14 @@ export const coinABI = [
988
1016
  { type: 'error', inputs: [], name: 'NumDiscoveryPositionsOutOfRange' },
989
1017
  { type: 'error', inputs: [], name: 'OneOwnerRequired' },
990
1018
  { type: 'error', inputs: [], name: 'OnlyOwner' },
991
- { type: 'error', inputs: [], name: 'OnlyPool' },
1019
+ {
1020
+ type: 'error',
1021
+ inputs: [
1022
+ { name: 'sender', internalType: 'address', type: 'address' },
1023
+ { name: 'pool', internalType: 'address', type: 'address' },
1024
+ ],
1025
+ name: 'OnlyPool',
1026
+ },
992
1027
  { type: 'error', inputs: [], name: 'OnlyWeth' },
993
1028
  { type: 'error', inputs: [], name: 'OwnerCannotBeAddressZero' },
994
1029
  { type: 'error', inputs: [], name: 'ReentrancyGuardReentrantCall' },
@@ -1141,10 +1176,6 @@ export const iUniswapV3PoolABI = [
1141
1176
  // ZoraFactoryImpl
1142
1177
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1143
1178
 
1144
- /**
1145
- * - [__View Contract on Base Basescan__](https://basescan.org/address/0x777777751622c0d3258f214F9DF38E35BF45baF3)
1146
- * - [__View Contract on Base Sepolia Basescan__](https://sepolia.basescan.org/address/0x777777751622c0d3258f214F9DF38E35BF45baF3)
1147
- */
1148
1179
  export const zoraFactoryImplABI = [
1149
1180
  {
1150
1181
  type: 'constructor',
@@ -1165,6 +1196,20 @@ export const zoraFactoryImplABI = [
1165
1196
  outputs: [{ name: '', internalType: 'address', type: 'address' }],
1166
1197
  stateMutability: 'view',
1167
1198
  },
1199
+ {
1200
+ type: 'function',
1201
+ inputs: [],
1202
+ name: 'contractName',
1203
+ outputs: [{ name: '', internalType: 'string', type: 'string' }],
1204
+ stateMutability: 'pure',
1205
+ },
1206
+ {
1207
+ type: 'function',
1208
+ inputs: [],
1209
+ name: 'contractVersion',
1210
+ outputs: [{ name: '', internalType: 'string', type: 'string' }],
1211
+ stateMutability: 'pure',
1212
+ },
1168
1213
  {
1169
1214
  type: 'function',
1170
1215
  inputs: [
@@ -1204,6 +1249,26 @@ export const zoraFactoryImplABI = [
1204
1249
  ],
1205
1250
  stateMutability: 'payable',
1206
1251
  },
1252
+ {
1253
+ type: 'function',
1254
+ inputs: [
1255
+ { name: 'payoutRecipient', internalType: 'address', type: 'address' },
1256
+ { name: 'owners', internalType: 'address[]', type: 'address[]' },
1257
+ { name: 'uri', internalType: 'string', type: 'string' },
1258
+ { name: 'name', internalType: 'string', type: 'string' },
1259
+ { name: 'symbol', internalType: 'string', type: 'string' },
1260
+ { name: 'poolConfig', internalType: 'bytes', type: 'bytes' },
1261
+ { name: 'platformReferrer', internalType: 'address', type: 'address' },
1262
+ { name: 'hook', internalType: 'address', type: 'address' },
1263
+ { name: 'hookData', internalType: 'bytes', type: 'bytes' },
1264
+ ],
1265
+ name: 'deployWithHook',
1266
+ outputs: [
1267
+ { name: 'coin', internalType: 'address', type: 'address' },
1268
+ { name: 'hookDataOut', internalType: 'bytes', type: 'bytes' },
1269
+ ],
1270
+ stateMutability: 'payable',
1271
+ },
1207
1272
  {
1208
1273
  type: 'function',
1209
1274
  inputs: [],
@@ -1382,6 +1447,7 @@ export const zoraFactoryImplABI = [
1382
1447
  { type: 'error', inputs: [], name: 'ERC20TransferAmountMismatch' },
1383
1448
  { type: 'error', inputs: [], name: 'EthTransferInvalid' },
1384
1449
  { type: 'error', inputs: [], name: 'FailedInnerCall' },
1450
+ { type: 'error', inputs: [], name: 'InvalidHook' },
1385
1451
  { type: 'error', inputs: [], name: 'InvalidInitialization' },
1386
1452
  { type: 'error', inputs: [], name: 'NotInitializing' },
1387
1453
  {
@@ -1406,22 +1472,12 @@ export const zoraFactoryImplABI = [
1406
1472
  inputs: [{ name: 'slot', internalType: 'bytes32', type: 'bytes32' }],
1407
1473
  name: 'UUPSUnsupportedProxiableUUID',
1408
1474
  },
1475
+ {
1476
+ type: 'error',
1477
+ inputs: [
1478
+ { name: 'currentName', internalType: 'string', type: 'string' },
1479
+ { name: 'newName', internalType: 'string', type: 'string' },
1480
+ ],
1481
+ name: 'UpgradeToMismatchedContractName',
1482
+ },
1409
1483
  ] as const
1410
-
1411
- /**
1412
- * - [__View Contract on Base Basescan__](https://basescan.org/address/0x777777751622c0d3258f214F9DF38E35BF45baF3)
1413
- * - [__View Contract on Base Sepolia Basescan__](https://sepolia.basescan.org/address/0x777777751622c0d3258f214F9DF38E35BF45baF3)
1414
- */
1415
- export const zoraFactoryImplAddress = {
1416
- 8453: '0x777777751622c0d3258f214F9DF38E35BF45baF3',
1417
- 84532: '0x777777751622c0d3258f214F9DF38E35BF45baF3',
1418
- } as const
1419
-
1420
- /**
1421
- * - [__View Contract on Base Basescan__](https://basescan.org/address/0x777777751622c0d3258f214F9DF38E35BF45baF3)
1422
- * - [__View Contract on Base Sepolia Basescan__](https://sepolia.basescan.org/address/0x777777751622c0d3258f214F9DF38E35BF45baF3)
1423
- */
1424
- export const zoraFactoryImplConfig = {
1425
- address: zoraFactoryImplAddress,
1426
- abi: zoraFactoryImplABI,
1427
- } as const
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/coins",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -30,9 +30,9 @@
30
30
  "tsx": "^3.13.0",
31
31
  "typescript": "^5.2.2",
32
32
  "viem": "^2.21.18",
33
- "@zoralabs/shared-contracts": "^0.0.2",
34
- "@zoralabs/shared-scripts": "^0.0.0",
35
- "@zoralabs/tsconfig": "^0.0.1"
33
+ "@zoralabs/shared-contracts": "^0.0.3",
34
+ "@zoralabs/tsconfig": "^0.0.1",
35
+ "@zoralabs/shared-scripts": "^0.0.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "pnpm run wagmi:generate && pnpm run copy-abis && pnpm run prettier:write && tsup",
@@ -8,6 +8,8 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/U
8
8
  import {ZoraFactoryImpl} from "../src/ZoraFactoryImpl.sol";
9
9
  import {Coin} from "../src/Coin.sol";
10
10
  import {IVersionedContract} from "@zoralabs/shared-contracts/interfaces/IVersionedContract.sol";
11
+ import {BuySupplyWithSwapRouterHook} from "../src/hooks/BuySupplyWithSwapRouterHook.sol";
12
+ import {IZoraFactory} from "../src/interfaces/IZoraFactory.sol";
11
13
 
12
14
  contract CoinsDeployerBase is ProxyDeployerScript {
13
15
  address internal constant PROTOCOL_REWARDS = 0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B;
@@ -21,6 +23,8 @@ contract CoinsDeployerBase is ProxyDeployerScript {
21
23
  // Implementation
22
24
  address coinImpl;
23
25
  string coinVersion;
26
+ // hooks
27
+ address buySupplyWithSwapRouterHook;
24
28
  }
25
29
 
26
30
  function addressesFile() internal view returns (string memory) {
@@ -33,6 +37,7 @@ contract CoinsDeployerBase is ProxyDeployerScript {
33
37
  vm.serializeAddress(objectKey, "ZORA_FACTORY", deployment.zoraFactory);
34
38
  vm.serializeAddress(objectKey, "ZORA_FACTORY_IMPL", deployment.zoraFactoryImpl);
35
39
  vm.serializeString(objectKey, "COIN_VERSION", deployment.coinVersion);
40
+ vm.serializeAddress(objectKey, "BUY_SUPPLY_WITH_SWAP_ROUTER_HOOK", deployment.buySupplyWithSwapRouterHook);
36
41
  string memory result = vm.serializeAddress(objectKey, "COIN_IMPL", deployment.coinImpl);
37
42
 
38
43
  vm.writeJson(result, addressesFile());
@@ -49,6 +54,7 @@ contract CoinsDeployerBase is ProxyDeployerScript {
49
54
  deployment.zoraFactoryImpl = readAddressOrDefaultToZero(json, "ZORA_FACTORY_IMPL");
50
55
  deployment.coinImpl = readAddressOrDefaultToZero(json, "COIN_IMPL");
51
56
  deployment.coinVersion = readStringOrDefaultToEmpty(json, "COIN_VERSION");
57
+ deployment.buySupplyWithSwapRouterHook = readAddressOrDefaultToZero(json, "BUY_SUPPLY_WITH_SWAP_ROUTER_HOOK");
52
58
  }
53
59
 
54
60
  function deployCoinImpl() internal returns (Coin) {
@@ -59,11 +65,16 @@ contract CoinsDeployerBase is ProxyDeployerScript {
59
65
  return new ZoraFactoryImpl(coinImpl);
60
66
  }
61
67
 
68
+ function deployBuySupplyWithSwapRouterHook(CoinsDeployment memory deployment) internal returns (BuySupplyWithSwapRouterHook) {
69
+ return new BuySupplyWithSwapRouterHook(IZoraFactory(deployment.zoraFactory), getUniswapSwapRouter());
70
+ }
71
+
62
72
  function deployImpls(CoinsDeployment memory deployment) internal returns (CoinsDeployment memory) {
63
73
  // Deploy implementation contracts
64
74
  deployment.coinImpl = address(deployCoinImpl());
65
75
  deployment.zoraFactoryImpl = address(deployZoraFactoryImpl(deployment.coinImpl));
66
76
  deployment.coinVersion = IVersionedContract(deployment.coinImpl).contractVersion();
77
+ deployment.buySupplyWithSwapRouterHook = address(deployBuySupplyWithSwapRouterHook(deployment));
67
78
 
68
79
  return deployment;
69
80
  }
@@ -101,4 +112,25 @@ contract CoinsDeployerBase is ProxyDeployerScript {
101
112
  // validate that the zora factory owner is the proxy admin
102
113
  require(ZoraFactoryImpl(deployment.zoraFactory).owner() == getProxyAdmin(), "Zora factory owner is not the proxy admin");
103
114
  }
115
+
116
+ function printUpgradeFactoryCommand(CoinsDeployment memory deployment) internal view {
117
+ // build upgrade to and call for factory, with init call
118
+ bytes memory call = abi.encodeWithSelector(UUPSUpgradeable.upgradeToAndCall.selector, deployment.zoraFactoryImpl, "");
119
+
120
+ address proxyAdmin = getProxyAdmin();
121
+
122
+ address target = address(deployment.zoraFactory);
123
+
124
+ // print the details for upgrading:
125
+
126
+ console.log("To upgrade the factory, this is the call information:");
127
+
128
+ console.log("Multisig:", proxyAdmin);
129
+ console.log("Target (the factory proxy):", target);
130
+ console.log("Upgrade call:");
131
+ console.logBytes(call);
132
+ console.log("Function to call: upgradeToAndCall");
133
+ // concat the args into a string, factoryImpl, ""
134
+ console.log("Args: ", string.concat(vm.toString(deployment.zoraFactoryImpl), ",", '"'));
135
+ }
104
136
  }
@@ -0,0 +1,22 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {CoinsDeployerBase} from "./CoinsDeployerBase.sol";
5
+ import {ZoraFactoryImpl} from "../src/ZoraFactoryImpl.sol";
6
+
7
+ contract DeployHooks is CoinsDeployerBase {
8
+ function run() public {
9
+ CoinsDeployment memory deployment = readDeployment();
10
+
11
+ vm.startBroadcast();
12
+
13
+ address buySupplyWithSwapRouterHook = address(deployBuySupplyWithSwapRouterHook(deployment));
14
+
15
+ deployment.buySupplyWithSwapRouterHook = buySupplyWithSwapRouterHook;
16
+
17
+ vm.stopBroadcast();
18
+
19
+ // save the deployment json
20
+ saveDeployment(deployment);
21
+ }
22
+ }
@@ -3,12 +3,13 @@ pragma solidity ^0.8.13;
3
3
 
4
4
  import {Script, console} from "forge-std/Script.sol";
5
5
 
6
- import {Coin, CoinConstants} from "../src/Coin.sol";
6
+ import {Coin} from "../src/Coin.sol";
7
+ import {CoinConstants} from "../src/libs/CoinConstants.sol";
7
8
  import {ZoraFactoryImpl} from "../src/ZoraFactoryImpl.sol";
8
9
  import {ZoraFactory} from "../src/proxy/ZoraFactory.sol";
9
10
 
10
11
  /// @dev For simulating pre-buys -- eg `forge script script/Simulate.s.sol --private-key $DEPLOYER_PK --rpc-url $BASE_MAINNET_RPC_URL -vvvv`
11
- contract Simulate is Script, CoinConstants {
12
+ contract Simulate is Script {
12
13
  // https://basescan.org/address/0x02B2705500096Ff83F9eF78873ca5DFB06C00Ddc
13
14
  address internal constant TEST_ZORA_FACTORY_ADDRESS_BASE_MAINNET = 0x02B2705500096Ff83F9eF78873ca5DFB06C00Ddc;
14
15
  address internal constant WETH_ADDRESS = 0x4200000000000000000000000000000000000006;
@@ -11,13 +11,13 @@ contract UpgradeCoinImpl is CoinsDeployerBase {
11
11
  vm.startBroadcast();
12
12
 
13
13
  // get deployer contract
14
- DeterministicDeployerAndCaller deployer = createOrGetDeployerAndCaller();
15
-
16
14
  deployment = deployImpls(deployment);
17
15
 
18
16
  vm.stopBroadcast();
19
17
 
20
18
  // save the deployment json
21
19
  saveDeployment(deployment);
20
+
21
+ printUpgradeFactoryCommand(deployment);
22
22
  }
23
23
  }
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {CoinsDeployerBase} from "./CoinsDeployerBase.sol";
5
+ import {ZoraFactoryImpl} from "../src/ZoraFactoryImpl.sol";
6
+
7
+ contract UpgradeFactoryImpl is CoinsDeployerBase {
8
+ function run() public {
9
+ CoinsDeployment memory deployment = readDeployment();
10
+
11
+ vm.startBroadcast();
12
+
13
+ ZoraFactoryImpl zoraFactoryImpl = deployZoraFactoryImpl(deployment.coinImpl);
14
+
15
+ deployment.zoraFactoryImpl = address(zoraFactoryImpl);
16
+
17
+ vm.stopBroadcast();
18
+
19
+ // save the deployment json
20
+ saveDeployment(deployment);
21
+ printUpgradeFactoryCommand(deployment);
22
+ }
23
+ }