@zoralabs/protocol-deployments 0.6.2 → 0.6.4-PRE.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.
- package/.turbo/turbo-build$colon$js.log +53 -0
- package/CHANGELOG.md +21 -2
- package/dist/{_esm-3RFC2XVO.js → _esm-OJM6GREZ.js} +138 -131
- package/dist/_esm-OJM6GREZ.js.map +1 -0
- package/dist/{ccip-C5WONSSK.js → ccip-4Y6T462U.js} +3 -2
- package/dist/chunk-BYTNVMX7.js +408 -0
- package/dist/chunk-BYTNVMX7.js.map +1 -0
- package/dist/{chunk-NPNNGXR4.js → chunk-KMBLRPCX.js} +980 -578
- package/dist/chunk-KMBLRPCX.js.map +1 -0
- package/dist/encoding.d.ts +0 -55
- package/dist/encoding.d.ts.map +1 -1
- package/dist/generated/wagmi.d.ts +4798 -5680
- package/dist/generated/wagmi.d.ts.map +1 -1
- package/dist/index.cjs +736 -1221
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +624 -1021
- package/dist/index.js.map +1 -1
- package/dist/{secp256k1-QZA5SALG.js → secp256k1-XP7IUONI.js} +438 -746
- package/dist/secp256k1-XP7IUONI.js.map +1 -0
- package/package.json +12 -11
- package/src/encoding.ts +1 -124
- package/src/generated/wagmi.ts +443 -805
- package/.turbo/turbo-build.log +0 -46
- package/LICENSE +0 -21
- package/dist/_esm-3RFC2XVO.js.map +0 -1
- package/dist/chunk-NPNNGXR4.js.map +0 -1
- package/dist/secp256k1-QZA5SALG.js.map +0 -1
- /package/dist/{ccip-C5WONSSK.js.map → ccip-4Y6T462U.js.map} +0 -0
package/src/encoding.ts
CHANGED
|
@@ -2,17 +2,11 @@ import {
|
|
|
2
2
|
Address,
|
|
3
3
|
decodeAbiParameters,
|
|
4
4
|
encodeAbiParameters,
|
|
5
|
-
encodeFunctionData,
|
|
6
5
|
getAbiItem,
|
|
7
6
|
} from "viem";
|
|
8
|
-
import {
|
|
9
|
-
uniswapV3SwapRouterABI,
|
|
10
|
-
poolConfigEncodingABI,
|
|
11
|
-
} from "./generated/wagmi";
|
|
12
|
-
import { buySupplyWithSwapRouterHookAddress } from "./generated/wagmi";
|
|
7
|
+
import { poolConfigEncodingABI } from "./generated/wagmi";
|
|
13
8
|
|
|
14
9
|
import { Hex } from "viem";
|
|
15
|
-
import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
|
|
16
10
|
|
|
17
11
|
/** ABI parameters for performing a SafeTransferFrom based swap when selling on secondary. */
|
|
18
12
|
export const safeTransferSwapAbiParameters = [
|
|
@@ -31,123 +25,6 @@ export const buySupplyWithSwapRouterHookReturnParameters = [
|
|
|
31
25
|
{ name: "coinsPurchased", internalType: "uint256", type: "uint256" },
|
|
32
26
|
] as const;
|
|
33
27
|
|
|
34
|
-
/**
|
|
35
|
-
* Encodes the calldata for the BuySupplyWithSwapRouterHook.
|
|
36
|
-
*
|
|
37
|
-
* @param buyRecipient - The address of the recipient of the coins that are purchased.
|
|
38
|
-
* @param swapRouterCall - The calldata to send for swapping on the swap router. For the call, the recipient of the swap
|
|
39
|
-
* must be the hook contract.
|
|
40
|
-
* @returns The encoded calldata.
|
|
41
|
-
*/
|
|
42
|
-
export const encodeBuySupplyWithSwapRouterHookCalldata = (
|
|
43
|
-
buyRecipient: Address,
|
|
44
|
-
swapRouterCall: Hex,
|
|
45
|
-
) => {
|
|
46
|
-
return encodeAbiParameters(buySupplyWithSwapRouterHookAbiParameters, [
|
|
47
|
-
buyRecipient,
|
|
48
|
-
swapRouterCall,
|
|
49
|
-
]);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
type ExactInputSingleParams = AbiParametersToPrimitiveTypes<
|
|
53
|
-
ExtractAbiFunction<
|
|
54
|
-
typeof uniswapV3SwapRouterABI,
|
|
55
|
-
"exactInputSingle"
|
|
56
|
-
>["inputs"]
|
|
57
|
-
>[0];
|
|
58
|
-
|
|
59
|
-
type ExactInputParams = AbiParametersToPrimitiveTypes<
|
|
60
|
-
ExtractAbiFunction<typeof uniswapV3SwapRouterABI, "exactInput">["inputs"]
|
|
61
|
-
>[0];
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Encodes the call data for buying supply with a single-hop swap router hook.
|
|
65
|
-
* This function creates the hook call and hook data needed to buy Coin supply using ETH through a Uniswap V3 single-hop swap.
|
|
66
|
-
*
|
|
67
|
-
* @param buyRecipient - The address that will receive the coins purchased
|
|
68
|
-
* @param exactInputSingleParams - The parameters for the exactInputSingle function on the swap router (recipient is omitted as it will be set to the hook address)
|
|
69
|
-
* @param chainId - The chain ID to use for getting the hook address
|
|
70
|
-
* @param ethValue - Optional amount of ETH to send with the call to the swap router
|
|
71
|
-
* @returns Object containing the encoded hook call, hook data, and ETH value
|
|
72
|
-
*/
|
|
73
|
-
export const encodeBuySupplyWithSingleHopSwapRouterHookCall = ({
|
|
74
|
-
buyRecipient,
|
|
75
|
-
exactInputSingleParams,
|
|
76
|
-
chainId,
|
|
77
|
-
ethValue,
|
|
78
|
-
}: {
|
|
79
|
-
buyRecipient: Address;
|
|
80
|
-
exactInputSingleParams: Omit<ExactInputSingleParams, "recipient">;
|
|
81
|
-
chainId: keyof typeof buySupplyWithSwapRouterHookAddress;
|
|
82
|
-
// optional amount of ETH to send with the call to the swap router
|
|
83
|
-
ethValue?: bigint;
|
|
84
|
-
}) => {
|
|
85
|
-
const hook = buySupplyWithSwapRouterHookAddress[chainId];
|
|
86
|
-
const callToSwapRouter = encodeFunctionData({
|
|
87
|
-
abi: uniswapV3SwapRouterABI,
|
|
88
|
-
functionName: "exactInputSingle",
|
|
89
|
-
args: [
|
|
90
|
-
{
|
|
91
|
-
recipient: hook,
|
|
92
|
-
...exactInputSingleParams,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
hook,
|
|
99
|
-
hookData: encodeBuySupplyWithSwapRouterHookCalldata(
|
|
100
|
-
buyRecipient,
|
|
101
|
-
callToSwapRouter,
|
|
102
|
-
),
|
|
103
|
-
value: ethValue,
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Encodes the call data for buying supply with a multi-hop swap router hook.
|
|
109
|
-
* This function creates the hook call and hook data needed to buy Coin supply using ETH through a Uniswap V3 multi-hop swap.
|
|
110
|
-
*
|
|
111
|
-
* @param buyRecipient - The address that will receive the coins purchased
|
|
112
|
-
* @param exactInputParams - The parameters for the exactInput function on the swap router (recipient is omitted as it will be set to the hook address)
|
|
113
|
-
* @param chainId - The chain ID to use for getting the hook address
|
|
114
|
-
* @param ethValue - Optional amount of ETH to send with the call to the swap router
|
|
115
|
-
* @returns Object containing the encoded hook call, hook data, and ETH value
|
|
116
|
-
*/
|
|
117
|
-
export const encodeBuySupplyWithMultiHopSwapRouterHookCall = ({
|
|
118
|
-
buyRecipient,
|
|
119
|
-
exactInputParams,
|
|
120
|
-
chainId,
|
|
121
|
-
ethValue,
|
|
122
|
-
}: {
|
|
123
|
-
buyRecipient: Address;
|
|
124
|
-
exactInputParams: Omit<ExactInputParams, "recipient">;
|
|
125
|
-
chainId: keyof typeof buySupplyWithSwapRouterHookAddress;
|
|
126
|
-
// optional amount of ETH to send with the call to the swap router
|
|
127
|
-
ethValue?: bigint;
|
|
128
|
-
}) => {
|
|
129
|
-
const hook = buySupplyWithSwapRouterHookAddress[chainId];
|
|
130
|
-
const callToSwapRouter = encodeFunctionData({
|
|
131
|
-
abi: uniswapV3SwapRouterABI,
|
|
132
|
-
functionName: "exactInput",
|
|
133
|
-
args: [
|
|
134
|
-
{
|
|
135
|
-
recipient: hook,
|
|
136
|
-
...exactInputParams,
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
hook,
|
|
143
|
-
hookData: encodeBuySupplyWithSwapRouterHookCalldata(
|
|
144
|
-
buyRecipient,
|
|
145
|
-
callToSwapRouter,
|
|
146
|
-
),
|
|
147
|
-
value: ethValue,
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
|
|
151
28
|
/**
|
|
152
29
|
* Decodes the return data from the BuySupplyWithSwapRouterHook.
|
|
153
30
|
*
|