@logswap/sdk 0.5.102 → 0.5.104
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/README.md +14 -418
- package/dist/actions.d.ts +0 -39
- package/dist/actions.js +0 -39
- package/dist/admin.d.ts +0 -106
- package/dist/admin.js +1 -96
- package/dist/chains.d.ts +0 -49
- package/dist/chains.js +0 -30
- package/dist/claims.d.ts +0 -32
- package/dist/claims.js +0 -30
- package/dist/client.d.ts +0 -116
- package/dist/client.js +1 -231
- package/dist/fees.d.ts +1 -45
- package/dist/fees.js +0 -44
- package/dist/fpool.d.ts +4 -612
- package/dist/fpool.js +14 -490
- package/dist/generated.js +0 -30
- package/dist/history.d.ts +0 -61
- package/dist/history.js +5 -74
- package/dist/ids.d.ts +0 -30
- package/dist/ids.js +0 -31
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -7
- package/dist/indexer.d.ts +0 -68
- package/dist/indexer.js +1 -77
- package/dist/keys.d.ts +0 -50
- package/dist/keys.js +0 -35
- package/dist/liquidity.d.ts +0 -128
- package/dist/liquidity.js +1 -107
- package/dist/onboard.d.ts +0 -52
- package/dist/onboard.js +1 -59
- package/dist/pools.d.ts +3 -157
- package/dist/pools.js +1 -164
- package/dist/positions.d.ts +0 -102
- package/dist/positions.js +1 -90
- package/dist/quote.d.ts +0 -14
- package/dist/quote.js +0 -14
- package/dist/swap.d.ts +0 -31
- package/dist/swap.js +5 -37
- package/dist/tokencache.d.ts +0 -48
- package/dist/tokencache.js +1 -73
- package/dist/write.d.ts +1 -87
- package/dist/write.js +1 -87
- package/package.json +3 -8
- package/src/actions.ts +0 -208
- package/src/admin.ts +0 -350
- package/src/chains.ts +0 -278
- package/src/claims.ts +0 -111
- package/src/client.ts +0 -436
- package/src/fees.ts +0 -138
- package/src/fpool.ts +0 -2049
- package/src/generated.ts +0 -4345
- package/src/history.ts +0 -383
- package/src/ids.ts +0 -78
- package/src/index.ts +0 -26
- package/src/indexer.ts +0 -264
- package/src/keys.ts +0 -138
- package/src/liquidity.ts +0 -456
- package/src/onboard.ts +0 -253
- package/src/pools.ts +0 -465
- package/src/positions.ts +0 -297
- package/src/quote.ts +0 -36
- package/src/swap.ts +0 -181
- package/src/tokencache.ts +0 -178
- package/src/write.ts +0 -236
package/src/admin.ts
DELETED
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* admin — the protocol's writes: the policies a pool may be born under (the registry's list, its sunsets), the C manager's
|
|
3
|
-
* creation modes, the two roles' two-step handovers (decision 066): the LOG Authority (the registry's `logAuthority`)
|
|
4
|
-
* administers the registry and both managers; the LOG Treasury (`treasury` on each manager) only receives, and is replaced by
|
|
5
|
-
* the authority's `proposeTreasury`. Plain writes to the managers and the registry; no router.
|
|
6
|
-
*
|
|
7
|
-
* The policies are immutable and deployed by the LOG (decision 098; policy.md): a policy has no setter of its numbers — its fee
|
|
8
|
-
* mask, quotes, bases, buffer, tax and cap bound are constructor immutables — so there is no wrapper that writes one. A change is
|
|
9
|
-
* a new policy, approved ({@link registryApprove}); the old one is sunset ({@link registrySunset}) and its pools run to their next
|
|
10
|
-
* close. The key's policy is the pool's for life: the registry's `migrate` and `orphan` are gone (F 41). What remains here for the
|
|
11
|
-
* policies is reading their numbers; their per-pool settings are in `fpool.ts`.
|
|
12
|
-
*
|
|
13
|
-
* The mint fee has no cut to set since C version 6 / F version 24 (decisions 058): the whole fee is the protocol's on both
|
|
14
|
-
* managers. A harvest has no cut (056); the protocol's share of a harvest's income is the policy's `incomeTaxRate` on the
|
|
15
|
-
* payer's slice, capped by the manager at `INCOME_TAX_MAX`.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import type { Address, Hash } from "viem";
|
|
19
|
-
import { poolId as keyId, FEE_LIST, type PoolKey } from "./keys.js";
|
|
20
|
-
import { managerC, type LogswapClient, type Side } from "./client.js";
|
|
21
|
-
import { getPool } from "./pools.js";
|
|
22
|
-
import { managerCAbi, managerFAbi, policyFAbi, policyCAbi, policyRegistryAbi } from "./generated.js";
|
|
23
|
-
import { bytes32ToText, fFeeListed, fPoolKindOfPolicy, fPolicyTermsOf, textToBytes32, type FPoolKind } from "./fpool.js";
|
|
24
|
-
|
|
25
|
-
function wallet(c: LogswapClient) {
|
|
26
|
-
if (!c.wallet) throw new Error("a wallet client is required");
|
|
27
|
-
return c.wallet;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function write(c: LogswapClient, address: Address, abi: readonly unknown[], functionName: string, args: readonly unknown[]): Promise<Hash> {
|
|
31
|
-
return wallet(c).writeContract({ address, abi, functionName, args, chain: c.wallet!.chain, account: c.wallet!.account! } as never);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The C swap-fee tax (decisions 060, 066, 098): the protocol's share of every swap fee a C position is
|
|
36
|
-
* paid (claims and the burn's auto-claim), WAD. `tax` is the level a market born under `policy` (default: the deployment's
|
|
37
|
-
* `publicPolicyC`) is given — the policy's immutable `swapFeeTax`; each market keeps the level of its birth for
|
|
38
|
-
* life — read it with {@link cMarketSwapFeeTax} or `getPool(key).swapFeeTax`. A different level is a different policy.
|
|
39
|
-
* `max` is the manager's bound.
|
|
40
|
-
*/
|
|
41
|
-
export async function cSwapFeeTax(c: LogswapClient, policy?: Address): Promise<{ tax: bigint; max: bigint }> {
|
|
42
|
-
const address = policy ?? c.addresses.publicPolicyC;
|
|
43
|
-
if (!address) throw new Error("logswap: this deployment carries no C policy (addresses.publicPolicyC); pass one");
|
|
44
|
-
const [tax, max] = await Promise.all([
|
|
45
|
-
c.public.readContract({ address, abi: policyCAbi, functionName: "swapFeeTax" } as never) as Promise<bigint>,
|
|
46
|
-
c.public.readContract({ address: managerC(c), abi: managerCAbi, functionName: "SWAP_FEE_TAX_MAX" }),
|
|
47
|
-
]);
|
|
48
|
-
return { tax, max };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** One C market's swap-fee tax, recorded at its birth (066). */
|
|
52
|
-
export async function cMarketSwapFeeTax(c: LogswapClient, key: PoolKey): Promise<bigint> {
|
|
53
|
-
return (await getPool(c, key)).swapFeeTax;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// ─── the registry: the LOG Authority's (046, 066) ───────────────────────────
|
|
57
|
-
|
|
58
|
-
const ZERO = "0x0000000000000000000000000000000000000000" as const;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The policy registry the F manager asks at every birth — `addresses.policyRegistry` when the
|
|
62
|
-
* deployment carries it, else read once from the manager. The zero address is a deployment with
|
|
63
|
-
* no registry: it asks nobody, and nothing here can be written.
|
|
64
|
-
*/
|
|
65
|
-
export async function policyRegistryOf(c: LogswapClient): Promise<Address> {
|
|
66
|
-
if (c.addresses.policyRegistry) return c.addresses.policyRegistry;
|
|
67
|
-
return (await c.public.readContract({ address: c.addresses.managerF, abi: managerFAbi, functionName: "registry" } as never)) as Address;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Whether `policy` is approved now — listed and not yet sunset. True everywhere on a deployment with no registry. */
|
|
71
|
-
export async function policyApproved(c: LogswapClient, policy: Address): Promise<boolean> {
|
|
72
|
-
const registry = await policyRegistryOf(c);
|
|
73
|
-
if (registry === ZERO) return true;
|
|
74
|
-
return c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "isApproved", args: [policy] } as never) as Promise<boolean>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** One policy on the registry's list, with what it is. */
|
|
78
|
-
export interface RegistryEntry {
|
|
79
|
-
policy: Address;
|
|
80
|
-
/** The label the policy's terms spell ({@link fPolicyTermsOf}) — what a pool born under it is; `null` for a policy that answers no F terms (a `PolicyC`). */
|
|
81
|
-
kind: FPoolKind | null;
|
|
82
|
-
/** The name recorded at approval (`approve(policy, name)`). */
|
|
83
|
-
name: string;
|
|
84
|
-
/** The time (unix seconds) it closes to new pools from; 0 = open. A block number before F version 29. */
|
|
85
|
-
until: bigint;
|
|
86
|
-
/** Approved now: listed and not yet sunset. */
|
|
87
|
-
approved: boolean;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Every policy listed, sunset ones included — one flat list, each with the kind its terms spell; `kind` narrows it to one,
|
|
92
|
-
* which is what a create form's dropdown reads. The registry is one list for both managers: a C policy is on it with `kind`
|
|
93
|
-
* `null`. Empty with no registry.
|
|
94
|
-
*/
|
|
95
|
-
export async function registryPolicies(c: LogswapClient, kind?: FPoolKind): Promise<RegistryEntry[]> {
|
|
96
|
-
const registry = await policyRegistryOf(c);
|
|
97
|
-
if (registry === ZERO) return [];
|
|
98
|
-
const list = (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "policies" } as never)) as readonly Address[];
|
|
99
|
-
// the registry compares `until` with block.timestamp (F version 29)
|
|
100
|
-
const now = (await c.public.getBlock({ blockTag: "latest" })).timestamp;
|
|
101
|
-
const all = await Promise.all(
|
|
102
|
-
list.map(async (policy) => {
|
|
103
|
-
const [[listed, until, , name], tag] = await Promise.all([
|
|
104
|
-
c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "entries", args: [policy] } as never) as Promise<[boolean, bigint, number, `0x${string}`]>,
|
|
105
|
-
fPoolKindOfPolicy(c, policy).catch(() => null), // a C policy answers no F terms
|
|
106
|
-
]);
|
|
107
|
-
return { policy, kind: tag, name: bytes32ToText(name), until, approved: listed && (until === 0n || now < until) };
|
|
108
|
-
}),
|
|
109
|
-
);
|
|
110
|
-
return kind ? all.filter((e) => e.kind === kind) : all;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* The LOG Authority (decision 066) — the registry's `logAuthority`, which administers the registry, both
|
|
115
|
-
* managers and every protocol policy — and the proposed next one. Zero with no registry: nothing on
|
|
116
|
-
* the deployment can be administered.
|
|
117
|
-
*/
|
|
118
|
-
export async function logAuthority(c: LogswapClient): Promise<{ authority: Address; pending: Address }> {
|
|
119
|
-
const registry = await policyRegistryOf(c);
|
|
120
|
-
if (registry === ZERO) return { authority: ZERO, pending: ZERO };
|
|
121
|
-
const [authority, pending] = await Promise.all([
|
|
122
|
-
c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "logAuthority" } as never) as Promise<Address>,
|
|
123
|
-
c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "pendingLogAuthority" } as never) as Promise<Address>,
|
|
124
|
-
]);
|
|
125
|
-
return { authority, pending };
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/** @deprecated F version 27 renamed the registry's `owner` to `authority`: use {@link logAuthority}. */
|
|
129
|
-
export async function registryOwner(c: LogswapClient): Promise<{ owner: Address; pending: Address }> {
|
|
130
|
-
const { authority, pending } = await logAuthority(c);
|
|
131
|
-
return { owner: authority, pending };
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async function registryWrite(c: LogswapClient, functionName: string, args: readonly unknown[]): Promise<Hash> {
|
|
135
|
-
const registry = await policyRegistryOf(c);
|
|
136
|
-
if (registry === ZERO) throw new Error("logswap: this deployment carries no policy registry");
|
|
137
|
-
return write(c, registry, policyRegistryAbi, functionName, args);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** `PolicyRegistry.approve`: list `policy` under `name` (at most 31 bytes). Again renames it and clears its sunset. The LOG Authority's. */
|
|
141
|
-
export async function registryApprove(c: LogswapClient, policy: Address, name: string): Promise<Hash> {
|
|
142
|
-
return registryWrite(c, "approve", [policy, textToBytes32(name)]);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** `PolicyRegistry.sunset`: close `policy` to new pools from `untilTime` (unix seconds, F version 29) on; 0 reopens. The LOG Authority's. */
|
|
146
|
-
export async function registrySunset(c: LogswapClient, policy: Address, untilTime: bigint): Promise<Hash> {
|
|
147
|
-
return registryWrite(c, "sunset", [policy, untilTime]);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/** `PolicyRegistry.revoke`: remove `policy` from the list at once. Live pools are untouched. The LOG Authority's. */
|
|
151
|
-
export async function registryRevoke(c: LogswapClient, policy: Address): Promise<Hash> {
|
|
152
|
-
return registryWrite(c, "revoke", [policy]);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* The LOG Authority's two-step handover (066): the authority proposes, the proposed address accepts
|
|
157
|
-
* by its own call (a Safe or a timelock sends `acceptLogAuthority` itself). One handover moves the
|
|
158
|
-
* administration of the registry, both managers and every policy; the treasury is a separate role.
|
|
159
|
-
*/
|
|
160
|
-
export async function proposeLogAuthority(c: LogswapClient, next: Address): Promise<Hash> {
|
|
161
|
-
return registryWrite(c, "proposeLogAuthority", [next]);
|
|
162
|
-
}
|
|
163
|
-
export async function acceptLogAuthority(c: LogswapClient): Promise<Hash> {
|
|
164
|
-
return registryWrite(c, "acceptLogAuthority", []);
|
|
165
|
-
}
|
|
166
|
-
/** @deprecated use {@link proposeLogAuthority}. */
|
|
167
|
-
export const registryProposeOwner = proposeLogAuthority;
|
|
168
|
-
/** @deprecated use {@link acceptLogAuthority}. */
|
|
169
|
-
export const registryAcceptOwner = acceptLogAuthority;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Approve or revoke, the F version 15–16 shape kept for callers: `approved` true is
|
|
173
|
-
* {@link registryApprove} under the policy's own tag as its name, false is {@link registryRevoke}.
|
|
174
|
-
*/
|
|
175
|
-
export async function setPolicyApproved(c: LogswapClient, policy: Address, approved: boolean): Promise<Hash> {
|
|
176
|
-
return approved ? registryApprove(c, policy, await fPoolKindOfPolicy(c, policy).catch(() => "policy")) : registryRevoke(c, policy);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* The name the registry recorded for `policy` at approval (`kindOf`, F version 20: `approve(policy, name)`'s word) — refreshed
|
|
181
|
-
* on re-approval and kept after a revoke. The LOG's own instances are approved as `public`, `private`, `pol`, `pad`; what a
|
|
182
|
-
* policy IS is its terms ({@link fPolicyTermsOf}). "" for a policy the registry never approved (or a deployment with no registry).
|
|
183
|
-
*/
|
|
184
|
-
export async function registryKindOf(c: LogswapClient, policy: Address): Promise<string> {
|
|
185
|
-
const registry = await policyRegistryOf(c);
|
|
186
|
-
if (registry === ZERO) return "";
|
|
187
|
-
const word = (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "kindOf", args: [policy] } as never)) as `0x${string}`;
|
|
188
|
-
return bytes32ToText(word);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// ─── the F policy's lists: immutable, so read-only here (policy.md §4.1) ─────
|
|
192
|
-
// The quotes a pool may be born on, the bases it may hold and the fee entries it may use are constructor values of the
|
|
193
|
-
// policy the LOG deploys. The whole set of numbers is `fPolicyTermsOf`; these answer one candidate.
|
|
194
|
-
|
|
195
|
-
/** Whether `quote` passes an F `policy`'s birth check now: it curates quotes (`quoteCurated`, a non-empty list set in the constructor) and lists it, or it does not curate. */
|
|
196
|
-
export async function policyQuoteAllowed(c: LogswapClient, policy: Address, quote: Address): Promise<{ curated: boolean; listed: boolean; allowed: boolean }> {
|
|
197
|
-
const [curated, listed] = await Promise.all([
|
|
198
|
-
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "quoteCurated" } as never) as Promise<boolean>,
|
|
199
|
-
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "quoteListed", args: [quote] } as never) as Promise<boolean>,
|
|
200
|
-
]);
|
|
201
|
-
return { curated, listed, allowed: !curated || listed };
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/** Whether `base` passes an F `policy`'s birth check now: it curates bases (`baseCurated`) and lists it, or it does not curate. */
|
|
205
|
-
export async function policyBaseAllowed(c: LogswapClient, policy: Address, base: Address): Promise<{ curated: boolean; listed: boolean; allowed: boolean }> {
|
|
206
|
-
const [curated, listed] = await Promise.all([
|
|
207
|
-
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "baseCurated" } as never) as Promise<boolean>,
|
|
208
|
-
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "baseListed", args: [base] } as never) as Promise<boolean>,
|
|
209
|
-
]);
|
|
210
|
-
return { curated, listed, allowed: !curated || listed };
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Whether the swap fee at `swapFeeIdx` of the F fee list passes `policy`'s birth check now (`feeMask`, policy.md §6). `curated` is true
|
|
215
|
-
* when the policy masks the list (a non-zero mask); with none, every entry is allowed. The mint fee follows the swap fee and is not asked.
|
|
216
|
-
*/
|
|
217
|
-
export async function policyFeeAllowed(c: LogswapClient, policy: Address, swapFeeIdx: number): Promise<{ curated: boolean; listed: boolean; allowed: boolean }> {
|
|
218
|
-
const { feeMask } = await fPolicyTermsOf(c, policy);
|
|
219
|
-
const listed = fFeeListed(feeMask, swapFeeIdx);
|
|
220
|
-
return { curated: feeMask !== 0, listed, allowed: listed };
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/** `PolicyRegistry.setForwarderTrusted` (the LOG Authority): a router whose `user()` names the creator. Moved off the public policy in F version 33. */
|
|
224
|
-
export async function registrySetForwarderTrusted(c: LogswapClient, forwarder: Address, trusted: boolean): Promise<Hash> {
|
|
225
|
-
return registryWrite(c, "setForwarderTrusted", [forwarder, trusted]);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* `PolicyRegistry.userOf(caller)` (C 15, decision 097): the account a caller acts for — the user a trusted forwarder
|
|
230
|
-
* (a router) names, else the caller itself. The account a manager names as a pool's creator and asks its policy about at a birth.
|
|
231
|
-
*/
|
|
232
|
-
export async function registryUserOf(c: LogswapClient, caller: Address): Promise<Address> {
|
|
233
|
-
const registry = await policyRegistryOf(c);
|
|
234
|
-
if (registry === ZERO) return caller;
|
|
235
|
-
return (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "userOf", args: [caller] } as never)) as Address;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export interface CGateRules {
|
|
239
|
-
/** The policy admits `creator` (`PolicyBase._admitBirth`): anyone on an open policy, the policy's authority on a closed one (`Refused`). */
|
|
240
|
-
creatorOk: boolean;
|
|
241
|
-
/** The quote is on the policy's list, or the policy lists none (`quoteCurated`). */
|
|
242
|
-
quoteOk: boolean;
|
|
243
|
-
/** The base is on the policy's list, or the policy lists none (`baseCurated`; `BaseNotListed`). */
|
|
244
|
-
baseOk: boolean;
|
|
245
|
-
/** The swap fee's index is on the policy's `feeMask` (an empty mask lists all eight; `FeeNotListed`). The mint fee follows it. */
|
|
246
|
-
feeOk: boolean;
|
|
247
|
-
/** An open policy needs `salt` zero (`NotCanonical`); a closed one may run several markets of one shape. */
|
|
248
|
-
saltOk: boolean;
|
|
249
|
-
/** The registry lists the policy and its sunset has not passed (`PolicyNotApproved`); true on a deployment with no registry. */
|
|
250
|
-
policyOk: boolean;
|
|
251
|
-
/** This exact market (the key's id) is already initialized: another is a different key. */
|
|
252
|
-
exists: boolean;
|
|
253
|
-
/** Every check passes: the policy would admit this market from this creator (the manager checks the two indices, `BadParam`). */
|
|
254
|
-
admitted: boolean;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* A C policy's birth checks for one candidate market and creator, in one round of reads — what the create form shows before a
|
|
259
|
-
* wallet is asked (C 18, decisions 099, 100: `PolicyC.mayInit`). The policy is `key.policy`; `creator` is the account that will call
|
|
260
|
-
* {@link initializeMarket}. The spacing is the manager's list ({@link SPACING_LIST}) and none of the policy's.
|
|
261
|
-
*/
|
|
262
|
-
export async function cGateRules(c: LogswapClient, a: { key: PoolKey; creator: Address; gate?: Address }): Promise<CGateRules> {
|
|
263
|
-
const g = a.gate ?? (a.key.policy as Address);
|
|
264
|
-
const rd = <T>(functionName: string, args: readonly unknown[] = []) =>
|
|
265
|
-
c.public.readContract({ address: g, abi: policyCAbi, functionName, args } as never) as Promise<T>;
|
|
266
|
-
const { key } = a;
|
|
267
|
-
const [open, authority, feeMask, quoteCurated, quoteListed, baseCurated, baseListed, state, policyOk] = await Promise.all([
|
|
268
|
-
rd<boolean>("open"),
|
|
269
|
-
rd<Address>("authority"),
|
|
270
|
-
rd<number | bigint>("feeMask"),
|
|
271
|
-
rd<boolean>("quoteCurated"),
|
|
272
|
-
rd<boolean>("quoteListed", [key.quote]),
|
|
273
|
-
rd<boolean>("baseCurated"),
|
|
274
|
-
rd<boolean>("baseListed", [key.base]),
|
|
275
|
-
getPool(c, key),
|
|
276
|
-
policyApproved(c, g),
|
|
277
|
-
]);
|
|
278
|
-
const r = {
|
|
279
|
-
creatorOk: open || authority.toLowerCase() === a.creator.toLowerCase(),
|
|
280
|
-
quoteOk: !quoteCurated || quoteListed,
|
|
281
|
-
baseOk: !baseCurated || baseListed,
|
|
282
|
-
feeOk: key.swapFeeIdx < FEE_LIST.length && fFeeListed(Number(feeMask), key.swapFeeIdx),
|
|
283
|
-
saltOk: !open || key.salt === "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
284
|
-
policyOk,
|
|
285
|
-
exists: state.initialized,
|
|
286
|
-
};
|
|
287
|
-
return { ...r, admitted: r.creatorOk && r.quoteOk && r.baseOk && r.feeOk && r.saltOk && r.policyOk && !r.exists };
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Every refusal a birth can meet at a policy or the registry (064, 065, 098; policy.md §4.4), for `decodeErrorResult` on a
|
|
292
|
-
* failed simulation: the C policy's errors, the F policy's (`Refused`, `NotCanonical`, `FeeNotListed`, `QuoteNotListed`,
|
|
293
|
-
* `BaseNotListed`, `TooManyLegs`, `AlreadyHeld`, …) and the registry's `NotListed`. One entry per distinct signature.
|
|
294
|
-
*/
|
|
295
|
-
type AbiError = { type: "error"; name: string; inputs: readonly { type: string; name?: string }[] };
|
|
296
|
-
const isAbiError = (x: { type: string }): x is AbiError => x.type === "error";
|
|
297
|
-
export const gateErrorAbi: readonly AbiError[] = (() => {
|
|
298
|
-
const seen = new Set<string>();
|
|
299
|
-
const sig = (x: AbiError) => `${x.name}(${x.inputs.map((i) => i.type).join(",")})`;
|
|
300
|
-
const all = (abi: readonly unknown[]) => (abi as readonly { type: string }[]).filter(isAbiError);
|
|
301
|
-
const errors: AbiError[] = [
|
|
302
|
-
...all(policyCAbi),
|
|
303
|
-
...all(policyFAbi),
|
|
304
|
-
// who creates under a policy is the policy's rule (C 18, decision 100); the registry only lists the policy
|
|
305
|
-
...all(policyRegistryAbi).filter((x) => x.name === "NotListed"),
|
|
306
|
-
];
|
|
307
|
-
return errors.filter((x) => (seen.has(sig(x)) ? false : (seen.add(sig(x)), true)));
|
|
308
|
-
})();
|
|
309
|
-
|
|
310
|
-
// ─── the LOG Treasury (066): receives, administers nothing ───────────────────
|
|
311
|
-
|
|
312
|
-
function manager(c: LogswapClient, side: Side): { address: Address; abi: readonly unknown[] } {
|
|
313
|
-
return side === "C" ? { address: managerC(c), abi: managerCAbi } : { address: c.addresses.managerF, abi: managerFAbi };
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/** A manager's treasury — where its protocol revenue goes — and the proposed next one. */
|
|
317
|
-
export async function logTreasury(c: LogswapClient, side: Side): Promise<{ treasury: Address; pending: Address }> {
|
|
318
|
-
const m = manager(c, side);
|
|
319
|
-
const [treasury, pending] = await Promise.all([
|
|
320
|
-
c.public.readContract({ ...m, functionName: "treasury" } as never) as Promise<Address>,
|
|
321
|
-
c.public.readContract({ ...m, functionName: "pendingTreasury" } as never) as Promise<Address>,
|
|
322
|
-
]);
|
|
323
|
-
return { treasury, pending };
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Propose a manager's next treasury: the LOG Authority's call, never the treasury's own, so a
|
|
328
|
-
* treasury that can no longer act is replaced without it. Nothing the old treasury holds moves.
|
|
329
|
-
*/
|
|
330
|
-
export async function proposeTreasury(c: LogswapClient, side: Side, next: Address): Promise<Hash> {
|
|
331
|
-
const m = manager(c, side);
|
|
332
|
-
return write(c, m.address, m.abi, "proposeTreasury", [next]);
|
|
333
|
-
}
|
|
334
|
-
/** The proposed treasury takes the role, sending from its own address. */
|
|
335
|
-
export async function acceptTreasury(c: LogswapClient, side: Side): Promise<Hash> {
|
|
336
|
-
const m = manager(c, side);
|
|
337
|
-
return write(c, m.address, m.abi, "acceptTreasury", []);
|
|
338
|
-
}
|
|
339
|
-
/** @deprecated the collector became the treasury (066), proposed by the LOG Authority: use {@link proposeTreasury}. */
|
|
340
|
-
export const proposeCollector = proposeTreasury;
|
|
341
|
-
/** @deprecated use {@link acceptTreasury}. */
|
|
342
|
-
export const acceptCollector = acceptTreasury;
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* `ManagerC.collectProtocolFees(poolId)`: pay one market's `protocolOwed` (mint fees and swap-fee
|
|
346
|
-
* tax) to the treasury. Anyone may send it (066); the destination is fixed.
|
|
347
|
-
*/
|
|
348
|
-
export async function collectCProtocolFees(c: LogswapClient, key: PoolKey): Promise<Hash> {
|
|
349
|
-
return write(c, managerC(c), managerCAbi, "collectProtocolFees", [keyId(key)]);
|
|
350
|
-
}
|
package/src/chains.ts
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* chains.ts — the chains log(swap) runs on, and their deployments.
|
|
3
|
-
*
|
|
4
|
-
* The release chains carry the contracts at ONE address each (CREATE3 through CreateX, contracts
|
|
5
|
-
* decision 069): the same `LogswapAddresses` on every chain. What differs per chain is the deploy
|
|
6
|
-
* block, the quote tokens, the explorer and the indexer. An address therefore names a contract only
|
|
7
|
-
* together with a chain id; every cache and every indexer URL in this SDK is per chain.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { defineChain, getAddress, isAddress, zeroAddress, type Address, type Chain } from "viem";
|
|
11
|
-
import { arbitrum, base, foundry, mainnet, robinhood, robinhoodTestnet } from "viem/chains";
|
|
12
|
-
import type { LogswapAddresses } from "./client.js";
|
|
13
|
-
|
|
14
|
-
/** A quote token a chain's policies list at deployment (`deployments/config/<chainId>.json`). */
|
|
15
|
-
export interface LogswapQuote {
|
|
16
|
-
symbol: string;
|
|
17
|
-
address: Address;
|
|
18
|
-
decimals: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface LogswapChain {
|
|
22
|
-
chainId: number;
|
|
23
|
-
/** The deployment artifact's `network` (`deployments/<chainId>.json`). */
|
|
24
|
-
network: string;
|
|
25
|
-
name: string;
|
|
26
|
-
/** The viem chain, for `createPublicClient({ chain })`. */
|
|
27
|
-
chain: Chain;
|
|
28
|
-
nativeCurrency: Chain["nativeCurrency"];
|
|
29
|
-
/** Block explorer root URL. */
|
|
30
|
-
explorer?: string;
|
|
31
|
-
/** A public JSON-RPC endpoint: rate-limited, for reads at low volume; production reads bring their own. */
|
|
32
|
-
publicRpc?: string;
|
|
33
|
-
/** A development chain: wiped and redeployed at the same addresses, so nothing keyed on its addresses persists. */
|
|
34
|
-
devnet: boolean;
|
|
35
|
-
testnet: boolean;
|
|
36
|
-
/** The quotes the deploy config lists, verified on chain (symbol, decimals). Empty where none is configured. */
|
|
37
|
-
quotes: readonly LogswapQuote[];
|
|
38
|
-
/** The quote pads launch against on this chain. */
|
|
39
|
-
padQuote?: Address;
|
|
40
|
-
/** Block span of one `eth_getLogs` call on this chain; the client's default {@link LogswapClient.maxLogRange}. */
|
|
41
|
-
maxLogRange: bigint;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** The logswap devnet (anvil, persisted with `--state`). No public RPC. */
|
|
45
|
-
export const logswapDevnet = defineChain({
|
|
46
|
-
id: 31339,
|
|
47
|
-
name: "log(swap) devnet",
|
|
48
|
-
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
49
|
-
rpcUrls: { default: { http: [] } },
|
|
50
|
-
testnet: true,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
/** Default block span per `eth_getLogs` call: public endpoints refuse wider ranges (or cap the result). */
|
|
54
|
-
export const DEFAULT_MAX_LOG_RANGE = 2_000n;
|
|
55
|
-
/** A local node answers any range. */
|
|
56
|
-
const LOCAL_MAX_LOG_RANGE = 1_000_000n;
|
|
57
|
-
|
|
58
|
-
const USDC = (address: Address): LogswapQuote => ({ symbol: "USDC", address, decimals: 6 });
|
|
59
|
-
const WETH = (address: Address): LogswapQuote => ({ symbol: "WETH", address, decimals: 18 });
|
|
60
|
-
|
|
61
|
-
function entry(chain: Chain, e: Omit<LogswapChain, "chainId" | "name" | "chain" | "nativeCurrency" | "testnet" | "maxLogRange"> & { maxLogRange?: bigint }): LogswapChain {
|
|
62
|
-
return {
|
|
63
|
-
chainId: chain.id,
|
|
64
|
-
name: chain.name,
|
|
65
|
-
chain,
|
|
66
|
-
nativeCurrency: chain.nativeCurrency,
|
|
67
|
-
testnet: chain.testnet ?? false,
|
|
68
|
-
maxLogRange: DEFAULT_MAX_LOG_RANGE,
|
|
69
|
-
...e,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** Every chain this SDK knows, by chain id. */
|
|
74
|
-
export const LOGSWAP_CHAINS: Readonly<Record<number, LogswapChain>> = Object.freeze({
|
|
75
|
-
1: entry(mainnet, {
|
|
76
|
-
network: "mainnet",
|
|
77
|
-
explorer: "https://etherscan.io",
|
|
78
|
-
publicRpc: "https://ethereum-rpc.publicnode.com",
|
|
79
|
-
devnet: false,
|
|
80
|
-
quotes: [USDC("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), WETH("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")],
|
|
81
|
-
padQuote: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
82
|
-
}),
|
|
83
|
-
8453: entry(base, {
|
|
84
|
-
network: "base",
|
|
85
|
-
explorer: "https://basescan.org",
|
|
86
|
-
publicRpc: "https://mainnet.base.org",
|
|
87
|
-
devnet: false,
|
|
88
|
-
quotes: [USDC("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"), WETH("0x4200000000000000000000000000000000000006")],
|
|
89
|
-
padQuote: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
90
|
-
}),
|
|
91
|
-
42161: entry(arbitrum, {
|
|
92
|
-
network: "arbitrum",
|
|
93
|
-
explorer: "https://arbiscan.io",
|
|
94
|
-
publicRpc: "https://arb1.arbitrum.io/rpc",
|
|
95
|
-
devnet: false,
|
|
96
|
-
quotes: [USDC("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"), WETH("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1")],
|
|
97
|
-
padQuote: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
98
|
-
}),
|
|
99
|
-
// no native USDC: USDG is the dollar quote
|
|
100
|
-
4663: entry(robinhood, {
|
|
101
|
-
network: "robinhood",
|
|
102
|
-
explorer: "https://robinhoodchain.blockscout.com",
|
|
103
|
-
publicRpc: "https://rpc.mainnet.chain.robinhood.com",
|
|
104
|
-
devnet: false,
|
|
105
|
-
quotes: [{ symbol: "USDG", address: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", decimals: 6 }, WETH("0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73")],
|
|
106
|
-
padQuote: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
107
|
-
}),
|
|
108
|
-
46630: entry(robinhoodTestnet, {
|
|
109
|
-
network: "robinhood-testnet",
|
|
110
|
-
explorer: robinhoodTestnet.blockExplorers.default.url,
|
|
111
|
-
publicRpc: robinhoodTestnet.rpcUrls.default.http[0],
|
|
112
|
-
devnet: false,
|
|
113
|
-
quotes: [],
|
|
114
|
-
}),
|
|
115
|
-
31337: entry(foundry, { network: "local", publicRpc: "http://127.0.0.1:8545", devnet: true, quotes: [], maxLogRange: LOCAL_MAX_LOG_RANGE }),
|
|
116
|
-
31339: entry(logswapDevnet, { network: "devnet", devnet: true, quotes: [], maxLogRange: LOCAL_MAX_LOG_RANGE }),
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/** The production chains, in release order. */
|
|
120
|
-
export const RELEASE_CHAIN_IDS = [1, 8453, 42161, 4663] as const;
|
|
121
|
-
|
|
122
|
-
/** The registry entry for `chainId`, or undefined for a chain this SDK does not list. */
|
|
123
|
-
export function logswapChain(chainId: number): LogswapChain | undefined {
|
|
124
|
-
return LOGSWAP_CHAINS[chainId];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** A quote of `chainId` by symbol (case-insensitive), or undefined. */
|
|
128
|
-
export function quoteOf(chainId: number, symbol: string): LogswapQuote | undefined {
|
|
129
|
-
const s = symbol.toLowerCase();
|
|
130
|
-
return LOGSWAP_CHAINS[chainId]?.quotes.find((q) => q.symbol.toLowerCase() === s);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// ─── deployments ──────────────────────────────────────────────────────────────
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* A deployment artifact: `deployments/<chainId>.json` as the contracts' `DeployChain.s.sol` writes
|
|
137
|
-
* it. `DeployLocal`'s artifact carries the same fields (without `deployTag` and `createX`) plus its
|
|
138
|
-
* devnet extras, of which `tokenFactory` is kept.
|
|
139
|
-
*/
|
|
140
|
-
export interface LogswapDeployment {
|
|
141
|
-
chainId: number;
|
|
142
|
-
network: string;
|
|
143
|
-
/** The first block of the deployment: where every log scan starts. */
|
|
144
|
-
deployBlock: bigint;
|
|
145
|
-
cVersion: bigint;
|
|
146
|
-
fVersion: bigint;
|
|
147
|
-
/** The CREATE3 salt namespace (`logswap.v1`); absent on a local deployment. */
|
|
148
|
-
deployTag?: string;
|
|
149
|
-
deployer: Address;
|
|
150
|
-
createX?: Address;
|
|
151
|
-
logAuthority: Address;
|
|
152
|
-
logTreasury: Address;
|
|
153
|
-
permit2: Address;
|
|
154
|
-
multicall3: Address;
|
|
155
|
-
policyRegistry: Address;
|
|
156
|
-
managerF: Address;
|
|
157
|
-
routerF: Address;
|
|
158
|
-
lensF: Address;
|
|
159
|
-
/** The C stack (decision 096): absent while the chain has not opted into C (the artifact carries `address(0)` and `cVersion` 0). */
|
|
160
|
-
managerC?: Address;
|
|
161
|
-
routerC?: Address;
|
|
162
|
-
lensC?: Address;
|
|
163
|
-
/** The LOG's open F policy (`PolicyF`, `open`: anyone creates at salt zero, no gate ever; policy.md). */
|
|
164
|
-
publicPolicy: Address;
|
|
165
|
-
/** The LOG's desk on F (`PolicyF`, closed: the LOG creates, gates by pool). The artifact key predates 098 and is kept. */
|
|
166
|
-
privatePolicy: Address;
|
|
167
|
-
/** The LOG's POL policy on F (`PolicyF`: one base, a bid buffer, an income tax). */
|
|
168
|
-
polPolicy: Address;
|
|
169
|
-
/** The LOG's pad policy on F (`PolicyF`, `seedToDead`: income-only harvests, never closes). */
|
|
170
|
-
padPolicy: Address;
|
|
171
|
-
/** The LOG's open policy on C (`PolicyC`, `open`: anyone creates at salt zero, no gate ever). Absent while the chain has no C stack. */
|
|
172
|
-
publicPolicyC?: Address;
|
|
173
|
-
/** The devnet's token factory; local deployments only. */
|
|
174
|
-
tokenFactory?: Address;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* The published deployments, by chain id. Empty until the release chains are deployed; a
|
|
179
|
-
* deployment is added here from its artifact in the release that ships it.
|
|
180
|
-
*/
|
|
181
|
-
export const LOGSWAP_DEPLOYMENTS: Readonly<Record<number, LogswapDeployment>> = Object.freeze({});
|
|
182
|
-
|
|
183
|
-
/** The published deployment on `chainId`, or undefined. */
|
|
184
|
-
export function deploymentFor(chainId: number): LogswapDeployment | undefined {
|
|
185
|
-
return LOGSWAP_DEPLOYMENTS[chainId];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const REQUIRED_ADDRESSES = [
|
|
189
|
-
"deployer",
|
|
190
|
-
"logAuthority",
|
|
191
|
-
"logTreasury",
|
|
192
|
-
"permit2",
|
|
193
|
-
"multicall3",
|
|
194
|
-
"policyRegistry",
|
|
195
|
-
"managerF",
|
|
196
|
-
"routerF",
|
|
197
|
-
"lensF",
|
|
198
|
-
"publicPolicy",
|
|
199
|
-
"privatePolicy",
|
|
200
|
-
"polPolicy",
|
|
201
|
-
"padPolicy",
|
|
202
|
-
] as const;
|
|
203
|
-
const OPTIONAL_ADDRESSES = ["createX", "tokenFactory"] as const;
|
|
204
|
-
/** Policies an artifact may carry as `address(0)` (no C stack): zero is absent. An `orphanPolicy` key on an older artifact is ignored (F 41 has none). */
|
|
205
|
-
const OPTIONAL_POLICIES = ["publicPolicyC"] as const;
|
|
206
|
-
/** The C stack: all three, or none (`address(0)` — the chain has not opted into C yet). */
|
|
207
|
-
const C_STACK = ["managerC", "routerC", "lensC"] as const;
|
|
208
|
-
|
|
209
|
-
function uint(o: Record<string, unknown>, k: string): bigint {
|
|
210
|
-
const v = o[k];
|
|
211
|
-
if (typeof v === "bigint" && v >= 0n) return v;
|
|
212
|
-
if (typeof v === "number" && Number.isSafeInteger(v) && v >= 0) return BigInt(v);
|
|
213
|
-
if (typeof v === "string" && /^(0x[0-9a-fA-F]+|\d+)$/.test(v)) return BigInt(v);
|
|
214
|
-
throw new Error(`logswap: deployment artifact: "${k}" is ${JSON.stringify(v)}, expected a non-negative integer`);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function address(o: Record<string, unknown>, k: string): Address {
|
|
218
|
-
const v = o[k];
|
|
219
|
-
if (typeof v !== "string" || !isAddress(v, { strict: false })) {
|
|
220
|
-
throw new Error(`logswap: deployment artifact: "${k}" is ${JSON.stringify(v)}, expected an address`);
|
|
221
|
-
}
|
|
222
|
-
return getAddress(v);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Validate a deployment artifact (parsed JSON) and return it typed. Throws on a missing or
|
|
227
|
-
* malformed field, and on a `chainId` other than `opts.chainId` when given: one address set is valid
|
|
228
|
-
* on every release chain, so an artifact read for the wrong chain would otherwise load cleanly and
|
|
229
|
-
* scan from the wrong `deployBlock`.
|
|
230
|
-
*/
|
|
231
|
-
export function deploymentFromArtifact(json: unknown, opts: { chainId?: number } = {}): LogswapDeployment {
|
|
232
|
-
if (typeof json !== "object" || json === null || Array.isArray(json)) throw new Error("logswap: deployment artifact is not a JSON object");
|
|
233
|
-
const o = json as Record<string, unknown>;
|
|
234
|
-
const chainId = Number(uint(o, "chainId"));
|
|
235
|
-
if (opts.chainId !== undefined && chainId !== opts.chainId) {
|
|
236
|
-
throw new Error(`logswap: deployment artifact is for chain ${chainId}, expected chain ${opts.chainId}`);
|
|
237
|
-
}
|
|
238
|
-
const network = o.network;
|
|
239
|
-
if (typeof network !== "string" || network === "") throw new Error(`logswap: deployment artifact: "network" is ${JSON.stringify(network)}`);
|
|
240
|
-
const d: Record<string, unknown> = {
|
|
241
|
-
chainId,
|
|
242
|
-
network,
|
|
243
|
-
deployBlock: uint(o, "deployBlock"),
|
|
244
|
-
cVersion: uint(o, "cVersion"),
|
|
245
|
-
fVersion: uint(o, "fVersion"),
|
|
246
|
-
};
|
|
247
|
-
if (o.deployTag !== undefined) {
|
|
248
|
-
if (typeof o.deployTag !== "string") throw new Error(`logswap: deployment artifact: "deployTag" is ${JSON.stringify(o.deployTag)}`);
|
|
249
|
-
d.deployTag = o.deployTag;
|
|
250
|
-
}
|
|
251
|
-
for (const k of REQUIRED_ADDRESSES) d[k] = address(o, k);
|
|
252
|
-
for (const k of OPTIONAL_ADDRESSES) if (o[k] !== undefined) d[k] = address(o, k);
|
|
253
|
-
for (const k of OPTIONAL_POLICIES) if (o[k] !== undefined && address(o, k) !== zeroAddress) d[k] = address(o, k);
|
|
254
|
-
const present = C_STACK.filter((k) => o[k] !== undefined && address(o, k) !== zeroAddress);
|
|
255
|
-
if (present.length !== 0 && present.length !== C_STACK.length) {
|
|
256
|
-
throw new Error(`logswap: deployment artifact: the C stack is all or nothing, but only ${present.join(", ")} ${present.length === 1 ? "is" : "are"} set`);
|
|
257
|
-
}
|
|
258
|
-
for (const k of present) d[k] = address(o, k);
|
|
259
|
-
return d as unknown as LogswapDeployment;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/** The client's address set from a deployment. */
|
|
263
|
-
export function addressesOfDeployment(d: LogswapDeployment): LogswapAddresses {
|
|
264
|
-
return {
|
|
265
|
-
managerF: d.managerF,
|
|
266
|
-
routerF: d.routerF,
|
|
267
|
-
lensF: d.lensF,
|
|
268
|
-
...(d.managerC && d.routerC && d.lensC ? { managerC: d.managerC, routerC: d.routerC, lensC: d.lensC } : {}),
|
|
269
|
-
publicPolicy: d.publicPolicy,
|
|
270
|
-
privatePolicy: d.privatePolicy,
|
|
271
|
-
polPolicy: d.polPolicy,
|
|
272
|
-
padPolicy: d.padPolicy,
|
|
273
|
-
...(d.publicPolicyC ? { publicPolicyC: d.publicPolicyC } : {}),
|
|
274
|
-
policyRegistry: d.policyRegistry,
|
|
275
|
-
permit2: d.permit2,
|
|
276
|
-
...(d.tokenFactory ? { tokenFactory: d.tokenFactory } : {}),
|
|
277
|
-
};
|
|
278
|
-
}
|