-
Notifications
You must be signed in to change notification settings - Fork 9
/
types.ts
95 lines (80 loc) · 2.23 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { HumanAmount, MinimalToken, PoolTokenWithBalance } from '../data';
import { Address, Hex, PoolType } from '../types';
// Returned from API and used as input
export type PoolState = {
id: Hex;
address: Address;
type: string;
tokens: MinimalToken[];
protocolVersion: 1 | 2 | 3;
};
export type PoolStateWithBalances = {
id: Hex;
address: Address;
type: string;
tokens: PoolTokenWithBalance[];
totalShares: HumanAmount;
protocolVersion: 1 | 2 | 3;
};
export type PoolTokenWithUnderlying = MinimalToken & {
underlyingToken: MinimalToken | null;
};
export type PoolStateWithUnderlyings = {
id: Hex;
address: Address;
type: string;
tokens: PoolTokenWithUnderlying[];
protocolVersion: 1 | 2 | 3;
};
export type AddLiquidityAmounts = {
maxAmountsIn: bigint[];
maxAmountsInWithoutBpt: bigint[];
tokenInIndex: number | undefined;
minimumBpt: bigint;
};
export type RemoveLiquidityAmounts = {
minAmountsOut: bigint[];
tokenOutIndex: number | undefined;
maxBptAmountIn: bigint;
};
type NestedPoolBase = {
id: Hex;
address: Address;
type: PoolType;
level: number; // 0 is the bottom and the highest level is the top
};
export type NestedPoolV2 = NestedPoolBase & {
tokens: MinimalToken[]; // each token should have at least one
};
export type NestedPoolV3 = NestedPoolBase & {
tokens: PoolTokenWithUnderlying[]; // each token should have at least one
};
type NestedPoolStateBase = {
protocolVersion: 1 | 2 | 3;
mainTokens: {
address: Address;
decimals: number;
}[];
};
export type NestedPoolStateV2 = NestedPoolStateBase & {
protocolVersion: 1 | 2;
pools: NestedPoolV2[];
};
export type NestedPoolStateV3 = NestedPoolStateBase & {
protocolVersion: 3;
pools: NestedPoolV3[];
};
export type NestedPoolState = NestedPoolStateV2 | NestedPoolStateV3;
export enum PoolKind {
WEIGHTED = 0,
LEGACY_STABLE = 1,
COMPOSABLE_STABLE = 2,
COMPOSABLE_STABLE_V2 = 3,
// (note only Weighted and COMPOSABLE_STABLE_V2 will support proportional exits)
}
export type InitPoolAmounts = {
maxAmountsIn: bigint[];
};
export type InitPoolAmountsComposableStable = InitPoolAmounts & {
amountsIn: bigint[];
};