@towns-protocol/generated 0.0.213 → 0.0.215

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.
@@ -0,0 +1,250 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import type {
5
+ BaseContract,
6
+ BigNumber,
7
+ BigNumberish,
8
+ BytesLike,
9
+ CallOverrides,
10
+ ContractTransaction,
11
+ PayableOverrides,
12
+ PopulatedTransaction,
13
+ Signer,
14
+ utils,
15
+ } from "ethers";
16
+ import type {
17
+ FunctionFragment,
18
+ Result,
19
+ EventFragment,
20
+ } from "@ethersproject/abi";
21
+ import type { Listener, Provider } from "@ethersproject/providers";
22
+ import type {
23
+ TypedEventFilter,
24
+ TypedEvent,
25
+ TypedListener,
26
+ OnEvent,
27
+ PromiseOrValue,
28
+ } from "./common";
29
+
30
+ export declare namespace ISwapRouterBase {
31
+ export type ExactInputParamsStruct = {
32
+ tokenIn: PromiseOrValue<string>;
33
+ tokenOut: PromiseOrValue<string>;
34
+ amountIn: PromiseOrValue<BigNumberish>;
35
+ minAmountOut: PromiseOrValue<BigNumberish>;
36
+ recipient: PromiseOrValue<string>;
37
+ };
38
+
39
+ export type ExactInputParamsStructOutput = [
40
+ string,
41
+ string,
42
+ BigNumber,
43
+ BigNumber,
44
+ string
45
+ ] & {
46
+ tokenIn: string;
47
+ tokenOut: string;
48
+ amountIn: BigNumber;
49
+ minAmountOut: BigNumber;
50
+ recipient: string;
51
+ };
52
+
53
+ export type RouterParamsStruct = {
54
+ router: PromiseOrValue<string>;
55
+ approveTarget: PromiseOrValue<string>;
56
+ swapData: PromiseOrValue<BytesLike>;
57
+ };
58
+
59
+ export type RouterParamsStructOutput = [string, string, string] & {
60
+ router: string;
61
+ approveTarget: string;
62
+ swapData: string;
63
+ };
64
+ }
65
+
66
+ export interface ISwapRouterInterface extends utils.Interface {
67
+ functions: {
68
+ "executeSwap((address,address,uint256,uint256,address),(address,address,bytes),address)": FunctionFragment;
69
+ };
70
+
71
+ getFunction(nameOrSignatureOrTopic: "executeSwap"): FunctionFragment;
72
+
73
+ encodeFunctionData(
74
+ functionFragment: "executeSwap",
75
+ values: [
76
+ ISwapRouterBase.ExactInputParamsStruct,
77
+ ISwapRouterBase.RouterParamsStruct,
78
+ PromiseOrValue<string>
79
+ ]
80
+ ): string;
81
+
82
+ decodeFunctionResult(
83
+ functionFragment: "executeSwap",
84
+ data: BytesLike
85
+ ): Result;
86
+
87
+ events: {
88
+ "FeeDistribution(address,address,address,uint256,uint256)": EventFragment;
89
+ "Swap(address,address,address,address,uint256,uint256,address)": EventFragment;
90
+ "SwapRouterInitialized(address)": EventFragment;
91
+ };
92
+
93
+ getEvent(nameOrSignatureOrTopic: "FeeDistribution"): EventFragment;
94
+ getEvent(nameOrSignatureOrTopic: "Swap"): EventFragment;
95
+ getEvent(nameOrSignatureOrTopic: "SwapRouterInitialized"): EventFragment;
96
+ }
97
+
98
+ export interface FeeDistributionEventObject {
99
+ token: string;
100
+ treasury: string;
101
+ poster: string;
102
+ treasuryAmount: BigNumber;
103
+ posterAmount: BigNumber;
104
+ }
105
+ export type FeeDistributionEvent = TypedEvent<
106
+ [string, string, string, BigNumber, BigNumber],
107
+ FeeDistributionEventObject
108
+ >;
109
+
110
+ export type FeeDistributionEventFilter = TypedEventFilter<FeeDistributionEvent>;
111
+
112
+ export interface SwapEventObject {
113
+ router: string;
114
+ caller: string;
115
+ tokenIn: string;
116
+ tokenOut: string;
117
+ amountIn: BigNumber;
118
+ amountOut: BigNumber;
119
+ recipient: string;
120
+ }
121
+ export type SwapEvent = TypedEvent<
122
+ [string, string, string, string, BigNumber, BigNumber, string],
123
+ SwapEventObject
124
+ >;
125
+
126
+ export type SwapEventFilter = TypedEventFilter<SwapEvent>;
127
+
128
+ export interface SwapRouterInitializedEventObject {
129
+ spaceFactory: string;
130
+ }
131
+ export type SwapRouterInitializedEvent = TypedEvent<
132
+ [string],
133
+ SwapRouterInitializedEventObject
134
+ >;
135
+
136
+ export type SwapRouterInitializedEventFilter =
137
+ TypedEventFilter<SwapRouterInitializedEvent>;
138
+
139
+ export interface ISwapRouter extends BaseContract {
140
+ connect(signerOrProvider: Signer | Provider | string): this;
141
+ attach(addressOrName: string): this;
142
+ deployed(): Promise<this>;
143
+
144
+ interface: ISwapRouterInterface;
145
+
146
+ queryFilter<TEvent extends TypedEvent>(
147
+ event: TypedEventFilter<TEvent>,
148
+ fromBlockOrBlockhash?: string | number | undefined,
149
+ toBlock?: string | number | undefined
150
+ ): Promise<Array<TEvent>>;
151
+
152
+ listeners<TEvent extends TypedEvent>(
153
+ eventFilter?: TypedEventFilter<TEvent>
154
+ ): Array<TypedListener<TEvent>>;
155
+ listeners(eventName?: string): Array<Listener>;
156
+ removeAllListeners<TEvent extends TypedEvent>(
157
+ eventFilter: TypedEventFilter<TEvent>
158
+ ): this;
159
+ removeAllListeners(eventName?: string): this;
160
+ off: OnEvent<this>;
161
+ on: OnEvent<this>;
162
+ once: OnEvent<this>;
163
+ removeListener: OnEvent<this>;
164
+
165
+ functions: {
166
+ executeSwap(
167
+ params: ISwapRouterBase.ExactInputParamsStruct,
168
+ routerParams: ISwapRouterBase.RouterParamsStruct,
169
+ poster: PromiseOrValue<string>,
170
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
171
+ ): Promise<ContractTransaction>;
172
+ };
173
+
174
+ executeSwap(
175
+ params: ISwapRouterBase.ExactInputParamsStruct,
176
+ routerParams: ISwapRouterBase.RouterParamsStruct,
177
+ poster: PromiseOrValue<string>,
178
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
179
+ ): Promise<ContractTransaction>;
180
+
181
+ callStatic: {
182
+ executeSwap(
183
+ params: ISwapRouterBase.ExactInputParamsStruct,
184
+ routerParams: ISwapRouterBase.RouterParamsStruct,
185
+ poster: PromiseOrValue<string>,
186
+ overrides?: CallOverrides
187
+ ): Promise<BigNumber>;
188
+ };
189
+
190
+ filters: {
191
+ "FeeDistribution(address,address,address,uint256,uint256)"(
192
+ token?: PromiseOrValue<string> | null,
193
+ treasury?: PromiseOrValue<string> | null,
194
+ poster?: PromiseOrValue<string> | null,
195
+ treasuryAmount?: null,
196
+ posterAmount?: null
197
+ ): FeeDistributionEventFilter;
198
+ FeeDistribution(
199
+ token?: PromiseOrValue<string> | null,
200
+ treasury?: PromiseOrValue<string> | null,
201
+ poster?: PromiseOrValue<string> | null,
202
+ treasuryAmount?: null,
203
+ posterAmount?: null
204
+ ): FeeDistributionEventFilter;
205
+
206
+ "Swap(address,address,address,address,uint256,uint256,address)"(
207
+ router?: PromiseOrValue<string> | null,
208
+ caller?: PromiseOrValue<string> | null,
209
+ tokenIn?: null,
210
+ tokenOut?: null,
211
+ amountIn?: null,
212
+ amountOut?: null,
213
+ recipient?: null
214
+ ): SwapEventFilter;
215
+ Swap(
216
+ router?: PromiseOrValue<string> | null,
217
+ caller?: PromiseOrValue<string> | null,
218
+ tokenIn?: null,
219
+ tokenOut?: null,
220
+ amountIn?: null,
221
+ amountOut?: null,
222
+ recipient?: null
223
+ ): SwapEventFilter;
224
+
225
+ "SwapRouterInitialized(address)"(
226
+ spaceFactory?: null
227
+ ): SwapRouterInitializedEventFilter;
228
+ SwapRouterInitialized(
229
+ spaceFactory?: null
230
+ ): SwapRouterInitializedEventFilter;
231
+ };
232
+
233
+ estimateGas: {
234
+ executeSwap(
235
+ params: ISwapRouterBase.ExactInputParamsStruct,
236
+ routerParams: ISwapRouterBase.RouterParamsStruct,
237
+ poster: PromiseOrValue<string>,
238
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
239
+ ): Promise<BigNumber>;
240
+ };
241
+
242
+ populateTransaction: {
243
+ executeSwap(
244
+ params: ISwapRouterBase.ExactInputParamsStruct,
245
+ routerParams: ISwapRouterBase.RouterParamsStruct,
246
+ poster: PromiseOrValue<string>,
247
+ overrides?: PayableOverrides & { from?: PromiseOrValue<string> }
248
+ ): Promise<PopulatedTransaction>;
249
+ };
250
+ }
@@ -0,0 +1,346 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import { Contract, Signer, utils } from "ethers";
6
+ import type { Provider } from "@ethersproject/providers";
7
+ import type { ISwapFacet, ISwapFacetInterface } from "../ISwapFacet";
8
+
9
+ const _abi = [
10
+ {
11
+ type: "function",
12
+ name: "executeSwap",
13
+ inputs: [
14
+ {
15
+ name: "params",
16
+ type: "tuple",
17
+ internalType: "struct ISwapRouterBase.ExactInputParams",
18
+ components: [
19
+ {
20
+ name: "tokenIn",
21
+ type: "address",
22
+ internalType: "address",
23
+ },
24
+ {
25
+ name: "tokenOut",
26
+ type: "address",
27
+ internalType: "address",
28
+ },
29
+ {
30
+ name: "amountIn",
31
+ type: "uint256",
32
+ internalType: "uint256",
33
+ },
34
+ {
35
+ name: "minAmountOut",
36
+ type: "uint256",
37
+ internalType: "uint256",
38
+ },
39
+ {
40
+ name: "recipient",
41
+ type: "address",
42
+ internalType: "address",
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ name: "routerParams",
48
+ type: "tuple",
49
+ internalType: "struct ISwapRouterBase.RouterParams",
50
+ components: [
51
+ {
52
+ name: "router",
53
+ type: "address",
54
+ internalType: "address",
55
+ },
56
+ {
57
+ name: "approveTarget",
58
+ type: "address",
59
+ internalType: "address",
60
+ },
61
+ {
62
+ name: "swapData",
63
+ type: "bytes",
64
+ internalType: "bytes",
65
+ },
66
+ ],
67
+ },
68
+ {
69
+ name: "poster",
70
+ type: "address",
71
+ internalType: "address",
72
+ },
73
+ ],
74
+ outputs: [
75
+ {
76
+ name: "amountOut",
77
+ type: "uint256",
78
+ internalType: "uint256",
79
+ },
80
+ ],
81
+ stateMutability: "payable",
82
+ },
83
+ {
84
+ type: "function",
85
+ name: "getSwapFees",
86
+ inputs: [],
87
+ outputs: [
88
+ {
89
+ name: "treasuryBps",
90
+ type: "uint16",
91
+ internalType: "uint16",
92
+ },
93
+ {
94
+ name: "posterBps",
95
+ type: "uint16",
96
+ internalType: "uint16",
97
+ },
98
+ {
99
+ name: "collectPosterFeeToSpace",
100
+ type: "bool",
101
+ internalType: "bool",
102
+ },
103
+ ],
104
+ stateMutability: "view",
105
+ },
106
+ {
107
+ type: "function",
108
+ name: "getSwapRouter",
109
+ inputs: [],
110
+ outputs: [
111
+ {
112
+ name: "",
113
+ type: "address",
114
+ internalType: "address",
115
+ },
116
+ ],
117
+ stateMutability: "view",
118
+ },
119
+ {
120
+ type: "function",
121
+ name: "setSwapFeeConfig",
122
+ inputs: [
123
+ {
124
+ name: "posterFeeBps",
125
+ type: "uint16",
126
+ internalType: "uint16",
127
+ },
128
+ {
129
+ name: "collectPosterFeeToSpace",
130
+ type: "bool",
131
+ internalType: "bool",
132
+ },
133
+ ],
134
+ outputs: [],
135
+ stateMutability: "nonpayable",
136
+ },
137
+ {
138
+ type: "event",
139
+ name: "FeeDistribution",
140
+ inputs: [
141
+ {
142
+ name: "token",
143
+ type: "address",
144
+ indexed: true,
145
+ internalType: "address",
146
+ },
147
+ {
148
+ name: "treasury",
149
+ type: "address",
150
+ indexed: true,
151
+ internalType: "address",
152
+ },
153
+ {
154
+ name: "poster",
155
+ type: "address",
156
+ indexed: true,
157
+ internalType: "address",
158
+ },
159
+ {
160
+ name: "treasuryAmount",
161
+ type: "uint256",
162
+ indexed: false,
163
+ internalType: "uint256",
164
+ },
165
+ {
166
+ name: "posterAmount",
167
+ type: "uint256",
168
+ indexed: false,
169
+ internalType: "uint256",
170
+ },
171
+ ],
172
+ anonymous: false,
173
+ },
174
+ {
175
+ type: "event",
176
+ name: "Swap",
177
+ inputs: [
178
+ {
179
+ name: "router",
180
+ type: "address",
181
+ indexed: true,
182
+ internalType: "address",
183
+ },
184
+ {
185
+ name: "caller",
186
+ type: "address",
187
+ indexed: true,
188
+ internalType: "address",
189
+ },
190
+ {
191
+ name: "tokenIn",
192
+ type: "address",
193
+ indexed: false,
194
+ internalType: "address",
195
+ },
196
+ {
197
+ name: "tokenOut",
198
+ type: "address",
199
+ indexed: false,
200
+ internalType: "address",
201
+ },
202
+ {
203
+ name: "amountIn",
204
+ type: "uint256",
205
+ indexed: false,
206
+ internalType: "uint256",
207
+ },
208
+ {
209
+ name: "amountOut",
210
+ type: "uint256",
211
+ indexed: false,
212
+ internalType: "uint256",
213
+ },
214
+ {
215
+ name: "recipient",
216
+ type: "address",
217
+ indexed: false,
218
+ internalType: "address",
219
+ },
220
+ ],
221
+ anonymous: false,
222
+ },
223
+ {
224
+ type: "event",
225
+ name: "SwapExecuted",
226
+ inputs: [
227
+ {
228
+ name: "recipient",
229
+ type: "address",
230
+ indexed: true,
231
+ internalType: "address",
232
+ },
233
+ {
234
+ name: "tokenIn",
235
+ type: "address",
236
+ indexed: true,
237
+ internalType: "address",
238
+ },
239
+ {
240
+ name: "tokenOut",
241
+ type: "address",
242
+ indexed: true,
243
+ internalType: "address",
244
+ },
245
+ {
246
+ name: "amountIn",
247
+ type: "uint256",
248
+ indexed: false,
249
+ internalType: "uint256",
250
+ },
251
+ {
252
+ name: "amountOut",
253
+ type: "uint256",
254
+ indexed: false,
255
+ internalType: "uint256",
256
+ },
257
+ {
258
+ name: "poster",
259
+ type: "address",
260
+ indexed: false,
261
+ internalType: "address",
262
+ },
263
+ ],
264
+ anonymous: false,
265
+ },
266
+ {
267
+ type: "event",
268
+ name: "SwapFeeConfigUpdated",
269
+ inputs: [
270
+ {
271
+ name: "posterFeeBps",
272
+ type: "uint16",
273
+ indexed: false,
274
+ internalType: "uint16",
275
+ },
276
+ {
277
+ name: "collectPosterFeeToSpace",
278
+ type: "bool",
279
+ indexed: false,
280
+ internalType: "bool",
281
+ },
282
+ ],
283
+ anonymous: false,
284
+ },
285
+ {
286
+ type: "event",
287
+ name: "SwapRouterInitialized",
288
+ inputs: [
289
+ {
290
+ name: "spaceFactory",
291
+ type: "address",
292
+ indexed: false,
293
+ internalType: "address",
294
+ },
295
+ ],
296
+ anonymous: false,
297
+ },
298
+ {
299
+ type: "error",
300
+ name: "SwapFacet__SwapFailed",
301
+ inputs: [],
302
+ },
303
+ {
304
+ type: "error",
305
+ name: "SwapFacet__SwapRouterNotSet",
306
+ inputs: [],
307
+ },
308
+ {
309
+ type: "error",
310
+ name: "SwapFacet__TotalFeeTooHigh",
311
+ inputs: [],
312
+ },
313
+ {
314
+ type: "error",
315
+ name: "SwapRouter__InsufficientOutput",
316
+ inputs: [],
317
+ },
318
+ {
319
+ type: "error",
320
+ name: "SwapRouter__InvalidAmount",
321
+ inputs: [],
322
+ },
323
+ {
324
+ type: "error",
325
+ name: "SwapRouter__InvalidRouter",
326
+ inputs: [],
327
+ },
328
+ {
329
+ type: "error",
330
+ name: "SwapRouter__UnexpectedETH",
331
+ inputs: [],
332
+ },
333
+ ] as const;
334
+
335
+ export class ISwapFacet__factory {
336
+ static readonly abi = _abi;
337
+ static createInterface(): ISwapFacetInterface {
338
+ return new utils.Interface(_abi) as ISwapFacetInterface;
339
+ }
340
+ static connect(
341
+ address: string,
342
+ signerOrProvider: Signer | Provider
343
+ ): ISwapFacet {
344
+ return new Contract(address, _abi, signerOrProvider) as ISwapFacet;
345
+ }
346
+ }