@zoralabs/coins 0.4.0 → 0.5.1-sdkalpha.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 (50) hide show
  1. package/.env.example +7 -0
  2. package/.turbo/turbo-build.log +93 -74
  3. package/CHANGELOG.md +12 -0
  4. package/README.md +29 -0
  5. package/abis/Coin.json +10 -0
  6. package/abis/CoinTest.json +55 -0
  7. package/abis/Create2.json +28 -0
  8. package/abis/DeployScript.json +9 -0
  9. package/abis/DeterministicDeployerAndCaller.json +315 -0
  10. package/abis/DeterministicUUPSProxyDeployer.json +167 -0
  11. package/abis/FactoryTest.json +20 -0
  12. package/abis/GenerateDeterministicParams.json +9 -0
  13. package/abis/ICoin.json +10 -0
  14. package/abis/IImmutableCreate2Factory.json +93 -0
  15. package/abis/ISafe.json +15 -0
  16. package/abis/ISymbol.json +15 -0
  17. package/abis/ImmutableCreate2FactoryUtils.json +15 -0
  18. package/abis/LibString.json +7 -0
  19. package/abis/ProxyShim.json +112 -0
  20. package/abis/ZoraFactory.json +0 -5
  21. package/addresses/8453.json +5 -8
  22. package/addresses/84532.json +5 -8
  23. package/deterministicConfig/deployerAndCaller.json +5 -0
  24. package/deterministicConfig/zoraFactory.json +8 -0
  25. package/dist/index.cjs +100 -4
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.js +96 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/wagmiGenerated.d.ts +475 -0
  30. package/dist/wagmiGenerated.d.ts.map +1 -1
  31. package/foundry.toml +14 -0
  32. package/integration/.env +2 -0
  33. package/lcov.info +634 -0
  34. package/package/wagmiGenerated.ts +111 -2
  35. package/package.json +4 -3
  36. package/remappings.txt +2 -1
  37. package/script/CoinsDeployerBase.sol +98 -0
  38. package/script/Deploy.s.sol +14 -5
  39. package/script/GenerateDeterministicParams.s.sol +43 -0
  40. package/src/Coin.sol +25 -7
  41. package/src/ZoraFactoryImpl.sol +2 -2
  42. package/src/interfaces/ICoin.sol +8 -2
  43. package/src/proxy/ZoraFactory.sol +7 -1
  44. package/src/version/ContractVersionBase.sol +1 -1
  45. package/test/Coin.t.sol +152 -4
  46. package/test/Factory.t.sol +33 -0
  47. package/test/utils/BaseTest.sol +4 -4
  48. package/wagmi.config.ts +7 -1
  49. package/abis/Deploy.json +0 -29
  50. package/addresses/1.json +0 -4
package/.env.example ADDED
@@ -0,0 +1,7 @@
1
+ # Turnkey authentication and private key information
2
+ TURNKEY_API_PUBLIC_KEY=""
3
+ TURNKEY_API_PRIVATE_KEY=""
4
+ TURNKEY_ORGANIZATION_ID=""
5
+ TURNKEY_PRIVATE_KEY_ID="xxxx-xxx-xxxx-xxxx-xxxxxxxx"
6
+ TURNKEY_TARGET_ADDRESS="xxxxxxxx"
7
+ DEPLOYER="xxxxxx"
@@ -1,74 +1,93 @@
1
-
2
- > @zoralabs/coins@0.4.0 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
3
- > pnpm run wagmi:generate && pnpm run copy-abis && pnpm run prettier:write && tsup
4
-
5
-
6
- > @zoralabs/coins@0.4.0 wagmi:generate /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
7
- > FOUNDRY_PROFILE=dev forge build && wagmi generate && pnpm exec rename-generated-abi-casing ./package/wagmiGenerated.ts
8
-
9
- Compiling 79 files with Solc 0.8.23
10
- Solc 0.8.23 finished in 198.33s
11
- Compiler run successful with warnings:
12
- Warning (9302): Return value of low-level calls not used.
13
- --> test/Coin.t.sol:377:9:
14
- |
15
- 377 | address(coin).call{value: 1 ether}("");
16
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17
-
18
- - Validating plugins
19
- ✔ Validating plugins
20
- - Resolving contracts
21
- ✔ Resolving contracts
22
- - Running plugins
23
- ✔ Running plugins
24
- - Writing to package/wagmiGenerated.ts
25
- ✔ Writing to package/wagmiGenerated.ts
26
- 🔄 Processing 1 file(s) to replace 'Abi' with 'ABI'...
27
- 📝 Processing ./package/wagmiGenerated.ts...
28
- ✅ Updated ./package/wagmiGenerated.ts (2 replacements)
29
- All files processed successfully!
30
-
31
- > @zoralabs/coins@0.4.0 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
32
- > pnpm exec bundle-abis
33
-
34
-
35
- > @zoralabs/coins@0.4.0 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
36
- > prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'
37
-
38
- src/Coin.sol 728ms (unchanged)
39
- src/interfaces/ICoin.sol 36ms (unchanged)
40
- src/interfaces/ICoinComments.sol 3ms (unchanged)
41
- src/interfaces/IERC7572.sol 1ms (unchanged)
42
- src/interfaces/INonfungiblePositionManager.sol 21ms (unchanged)
43
- src/interfaces/IProtocolRewards.sol 6ms (unchanged)
44
- src/interfaces/ISwapRouter.sol 9ms (unchanged)
45
- src/interfaces/IUniswapV3Pool.sol 4ms (unchanged)
46
- src/interfaces/IUniswapV3SwapCallback.sol 3ms (unchanged)
47
- src/interfaces/IWETH.sol 8ms (unchanged)
48
- src/interfaces/IZoraFactory.sol 12ms (unchanged)
49
- src/proxy/ZoraFactory.sol 13ms (unchanged)
50
- src/utils/CoinConstants.sol 6ms (unchanged)
51
- src/utils/MultiOwnable.sol 88ms (unchanged)
52
- src/utils/TickMath.sol 138ms (unchanged)
53
- src/version/ContractVersionBase.sol 2ms (unchanged)
54
- src/ZoraFactoryImpl.sol 86ms (unchanged)
55
- test/Coin.t.sol 378ms (unchanged)
56
- test/Factory.t.sol 155ms (unchanged)
57
- test/MultiOwnable.t.sol 109ms (unchanged)
58
- test/utils/BaseTest.sol 108ms (unchanged)
59
- test/utils/ProtocolRewards.sol 407ms (unchanged)
60
- script/Deploy.s.sol 4ms (unchanged)
61
- CLI Building entry: package/index.ts
62
- CLI Using tsconfig: tsconfig.json
63
- CLI tsup v7.3.0
64
- CLI Using tsup config: /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins/tsup.config.ts
65
- CLI Target: es2021
66
- CLI Cleaning output folder
67
- CJS Build start
68
- ESM Build start
69
- ESM dist/index.js 30.86 KB
70
- ESM dist/index.js.map 56.19 KB
71
- ESM ⚡️ Build success in 20ms
72
- CJS dist/index.cjs 31.91 KB
73
- CJS dist/index.cjs.map 56.30 KB
74
- CJS ⚡️ Build success in 21ms
1
+
2
+ 
3
+ > @zoralabs/coins@0.5.0 build /Users/iain/zora/zora-protocol-private/packages/coins
4
+ > pnpm run wagmi:generate && pnpm run copy-abis && pnpm run prettier:write && tsup
5
+
6
+
7
+ > @zoralabs/coins@0.5.0 wagmi:generate /Users/iain/zora/zora-protocol-private/packages/coins
8
+ > FOUNDRY_PROFILE=dev forge build && wagmi generate && pnpm exec rename-generated-abi-casing ./package/wagmiGenerated.ts
9
+
10
+
11
+
12
+
13
+ Compiler run successful with warnings:
14
+ Warning (9302): Return value of low-level calls not used.
15
+ --> test/Coin.t.sol:527:9:
16
+  |
17
+ 527 | address(coin).call{value: 1 ether}("");
18
+  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
+
20
+ Warning (2072): Unused local variable.
21
+ --> script/DeployCoinImpl.s.sol:14:9:
22
+  |
23
+ 14 | DeterministicDeployerAndCaller deployer = createOrGetDeployerAndCaller();
24
+  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25
+
26
+ Warning (2072): Unused local variable.
27
+ --> test/Coin.t.sol:446:10:
28
+  |
29
+ 446 | (address newCoinAddr, ) = factory.deploy(
30
+  | ^^^^^^^^^^^^^^^^^^^
31
+
32
+ Warning (2072): Unused local variable.
33
+ --> test/Coin.t.sol:464:10:
34
+  |
35
+ 464 | (address newCoinAddr, ) = factory.deploy(
36
+  | ^^^^^^^^^^^^^^^^^^^
37
+
38
+ [?25l⠋ Validating plugins✔ Validating plugins
39
+ [?25h[?25l⠙ Resolving contracts✔ Resolving contracts
40
+ [?25h[?25l⠹ Running plugins✔ Running plugins
41
+ [?25h[?25l⠸ Writing to package/wagmiGenerated.ts[?25l⠼ Writing to package/wagmiGenerated.ts✔ Writing to package/wagmiGenerated.ts
42
+ [?25h🔄 Processing 1 file(s) to replace 'Abi' with 'ABI'...
43
+ 📝 Processing ./package/wagmiGenerated.ts...
44
+ ✅ Updated ./package/wagmiGenerated.ts (2 replacements)
45
+ All files processed successfully!
46
+
47
+ > @zoralabs/coins@0.5.0 copy-abis /Users/iain/zora/zora-protocol-private/packages/coins
48
+ > pnpm exec bundle-abis
49
+
50
+
51
+ > @zoralabs/coins@0.5.0 prettier:write /Users/iain/zora/zora-protocol-private/packages/coins
52
+ > prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'
53
+
54
+ src/Coin.solsrc/Coin.sol 364ms (unchanged)
55
+ src/interfaces/ICoin.solsrc/interfaces/ICoin.sol 19ms (unchanged)
56
+ src/interfaces/ICoinComments.solsrc/interfaces/ICoinComments.sol 2ms (unchanged)
57
+ src/interfaces/IERC7572.solsrc/interfaces/IERC7572.sol 1ms (unchanged)
58
+ src/interfaces/INonfungiblePositionManager.solsrc/interfaces/INonfungiblePositionManager.sol 8ms (unchanged)
59
+ src/interfaces/IProtocolRewards.solsrc/interfaces/IProtocolRewards.sol 3ms (unchanged)
60
+ src/interfaces/ISwapRouter.solsrc/interfaces/ISwapRouter.sol 2ms (unchanged)
61
+ src/interfaces/IUniswapV3Pool.solsrc/interfaces/IUniswapV3Pool.sol 2ms (unchanged)
62
+ src/interfaces/IUniswapV3SwapCallback.solsrc/interfaces/IUniswapV3SwapCallback.sol 1ms (unchanged)
63
+ src/interfaces/IWETH.solsrc/interfaces/IWETH.sol 2ms (unchanged)
64
+ src/interfaces/IZoraFactory.solsrc/interfaces/IZoraFactory.sol 3ms (unchanged)
65
+ src/proxy/ZoraFactory.solsrc/proxy/ZoraFactory.sol 7ms (unchanged)
66
+ src/utils/CoinConstants.solsrc/utils/CoinConstants.sol 4ms (unchanged)
67
+ src/utils/MultiOwnable.solsrc/utils/MultiOwnable.sol 47ms (unchanged)
68
+ src/utils/TickMath.solsrc/utils/TickMath.sol 89ms (unchanged)
69
+ src/version/ContractVersionBase.solsrc/version/ContractVersionBase.sol 1ms (unchanged)
70
+ src/ZoraFactoryImpl.solsrc/ZoraFactoryImpl.sol 45ms (unchanged)
71
+ test/Coin.t.soltest/Coin.t.sol 276ms (unchanged)
72
+ test/Factory.t.soltest/Factory.t.sol 131ms (unchanged)
73
+ test/MultiOwnable.t.soltest/MultiOwnable.t.sol 68ms (unchanged)
74
+ test/utils/BaseTest.soltest/utils/BaseTest.sol 69ms (unchanged)
75
+ test/utils/ProtocolRewards.soltest/utils/ProtocolRewards.sol 255ms (unchanged)
76
+ script/CoinsDeployerBase.solscript/CoinsDeployerBase.sol 30ms (unchanged)
77
+ script/Deploy.s.solscript/Deploy.s.sol 4ms (unchanged)
78
+ script/DeployCoinImpl.s.solscript/DeployCoinImpl.s.sol 4ms (unchanged)
79
+ script/GenerateDeterministicParams.s.solscript/GenerateDeterministicParams.s.sol 11ms (unchanged)
80
+ CLI Building entry: package/index.ts
81
+ CLI Using tsconfig: tsconfig.json
82
+ CLI tsup v7.3.0
83
+ CLI Using tsup config: /Users/iain/zora/zora-protocol-private/packages/coins/tsup.config.ts
84
+ CLI Target: es2021
85
+ CLI Cleaning output folder
86
+ CJS Build start
87
+ ESM Build start
88
+ CJS dist/index.cjs 32.06 KB
89
+ CJS dist/index.cjs.map 56.56 KB
90
+ CJS ⚡️ Build success in 12ms
91
+ ESM dist/index.js 31.00 KB
92
+ ESM dist/index.js.map 56.45 KB
93
+ ESM ⚡️ Build success in 12ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zoralabs/coins
2
2
 
3
+ ## 0.5.1-sdkalpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 29a34eaf: Introduce Coins SDK
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 39ffa77c: Add coin refunds for large sells with little liquidity
14
+
3
15
  ## 0.4.0
4
16
 
5
17
  ### Minor Changes
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Coins
2
+
3
+ ## Deployment
4
+
5
+ The `ZoraFactory` contract is deployed deterministically using a turnkey account. The deployment process uses a helper contract, [DeterministicDeployerAndCaller](../../packages/shared-contracts/src/deployment/DeterministicDeployerAndCaller.sol).
6
+
7
+ ### Prerequisites
8
+
9
+ - Ensure you have [Forge](https://book.getfoundry.sh/getting-started/installation) installed.
10
+ - Familiarity with [turnkey accounts](https://docs.turnkey.com/) is recommended.
11
+
12
+ ### Setting up environment variables
13
+
14
+ In the `packages/coins` directory:
15
+
16
+ 1. Copy `.env.example` to `.env`
17
+ 2. Populate the parameters in `.env`
18
+
19
+ ### Deploying the Coins Factory
20
+
21
+ 1. Deploy the `ZoraFactory` contract, you must pass the `--ffi` flag to enable calling an external script to sign the deployment with turnkey:
22
+
23
+ ```bash
24
+ forge script script/Deploy.s.sol $(chains {chainName} --deploy) --broadcast --verify --ffi
25
+ ```
26
+
27
+ where `{chainName}` is the emdash name of the chain you want to deploy on.
28
+
29
+ 2. Verify the factory contract. Since it is deployed with create2, foundry won't always recognize the deployed contract; verification instructions will be printed out in the logs.
package/abis/Coin.json CHANGED
@@ -288,6 +288,11 @@
288
288
  }
289
289
  ],
290
290
  "outputs": [
291
+ {
292
+ "name": "",
293
+ "type": "uint256",
294
+ "internalType": "uint256"
295
+ },
291
296
  {
292
297
  "name": "",
293
298
  "type": "uint256",
@@ -748,6 +753,11 @@
748
753
  }
749
754
  ],
750
755
  "outputs": [
756
+ {
757
+ "name": "",
758
+ "type": "uint256",
759
+ "internalType": "uint256"
760
+ },
751
761
  {
752
762
  "name": "",
753
763
  "type": "uint256",
@@ -308,6 +308,19 @@
308
308
  "outputs": [],
309
309
  "stateMutability": "nonpayable"
310
310
  },
311
+ {
312
+ "type": "function",
313
+ "name": "test_buy_validate_return_amounts",
314
+ "inputs": [
315
+ {
316
+ "name": "orderSize",
317
+ "type": "uint256",
318
+ "internalType": "uint256"
319
+ }
320
+ ],
321
+ "outputs": [],
322
+ "stateMutability": "nonpayable"
323
+ },
311
324
  {
312
325
  "type": "function",
313
326
  "name": "test_buy_with_eth",
@@ -405,6 +418,13 @@
405
418
  "outputs": [],
406
419
  "stateMutability": "nonpayable"
407
420
  },
421
+ {
422
+ "type": "function",
423
+ "name": "test_fork_buy_with_eth",
424
+ "inputs": [],
425
+ "outputs": [],
426
+ "stateMutability": "nonpayable"
427
+ },
408
428
  {
409
429
  "type": "function",
410
430
  "name": "test_initialize_validation",
@@ -412,6 +432,20 @@
412
432
  "outputs": [],
413
433
  "stateMutability": "nonpayable"
414
434
  },
435
+ {
436
+ "type": "function",
437
+ "name": "test_invalid_currency_tick",
438
+ "inputs": [],
439
+ "outputs": [],
440
+ "stateMutability": "nonpayable"
441
+ },
442
+ {
443
+ "type": "function",
444
+ "name": "test_invalid_weth_tick",
445
+ "inputs": [],
446
+ "outputs": [],
447
+ "stateMutability": "nonpayable"
448
+ },
415
449
  {
416
450
  "type": "function",
417
451
  "name": "test_market_slippage",
@@ -503,6 +537,20 @@
503
537
  "outputs": [],
504
538
  "stateMutability": "nonpayable"
505
539
  },
540
+ {
541
+ "type": "function",
542
+ "name": "test_sell_for_eth_direct_and_claim_secondary",
543
+ "inputs": [],
544
+ "outputs": [],
545
+ "stateMutability": "nonpayable"
546
+ },
547
+ {
548
+ "type": "function",
549
+ "name": "test_sell_for_eth_direct_and_claim_secondary_push_eth",
550
+ "inputs": [],
551
+ "outputs": [],
552
+ "stateMutability": "nonpayable"
553
+ },
506
554
  {
507
555
  "type": "function",
508
556
  "name": "test_sell_for_eth_fuzz",
@@ -523,6 +571,13 @@
523
571
  "outputs": [],
524
572
  "stateMutability": "nonpayable"
525
573
  },
574
+ {
575
+ "type": "function",
576
+ "name": "test_sell_partial_execution",
577
+ "inputs": [],
578
+ "outputs": [],
579
+ "stateMutability": "nonpayable"
580
+ },
526
581
  {
527
582
  "type": "function",
528
583
  "name": "test_set_contract_uri",
@@ -0,0 +1,28 @@
1
+ [
2
+ {
3
+ "type": "error",
4
+ "name": "Create2EmptyBytecode",
5
+ "inputs": []
6
+ },
7
+ {
8
+ "type": "error",
9
+ "name": "Create2FailedDeployment",
10
+ "inputs": []
11
+ },
12
+ {
13
+ "type": "error",
14
+ "name": "Create2InsufficientBalance",
15
+ "inputs": [
16
+ {
17
+ "name": "balance",
18
+ "type": "uint256",
19
+ "internalType": "uint256"
20
+ },
21
+ {
22
+ "name": "needed",
23
+ "type": "uint256",
24
+ "internalType": "uint256"
25
+ }
26
+ ]
27
+ }
28
+ ]
@@ -0,0 +1,9 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "run",
5
+ "inputs": [],
6
+ "outputs": [],
7
+ "stateMutability": "nonpayable"
8
+ }
9
+ ]