/
zapper.ts
104 lines (94 loc) 路 2.09 KB
/
zapper.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
96
97
98
99
100
101
102
103
104
import { Address, Integer } from "../common";
/**
* Simple gas prices in gwei
*/
export interface GasPrice {
eip1559: boolean;
standard: number;
instant: number;
fast: number;
}
export interface ZapOptions {
slippage?: number;
gas?: keyof GasPrice;
skipGasEstimate?: boolean;
}
export interface ZapApprovalStateOutput {
spenderAddress: Address;
tokenAddress: Address;
ownerAddress: Address;
allowance: Integer;
amount: Integer;
isApproved: boolean;
}
export interface ZapApprovalTransactionOutput {
data: string;
to: Address;
from: Address;
gasPrice: Integer;
}
export interface ZapOutput {
to: Address;
from: Address;
data: string;
value: string;
sellTokenAddress: Address;
sellTokenAmount: Integer;
buyTokenAddress: Address;
minTokens: Integer;
gasPrice: Integer;
gas: Integer;
}
export enum ZapProtocol {
PICKLE = "pickle",
YEARN = "yearn",
}
type VaultTokenMarketDataCategory = "deposit" | "pool" | "wallet";
export interface VaultTokenMarketData {
address: Address;
appId: "yearn";
appImageUrl: string;
appName: "Yearn";
apy?: number;
category: VaultTokenMarketDataCategory;
decimals: number;
img: string;
isBlocked: boolean;
label: string;
liquidity: number;
network: "ethereum";
price: number;
pricePerShare: number;
protcolDisplay: "Yearn";
supply: number;
symbol: string;
tokens: VaultTokenMarketDataToken[];
type: "vault";
}
type VaultTokenMarketDataType = "base" | "interest-bearing" | "pool" | "vault";
interface VaultTokenMarketDataToken {
address: Address;
appId?: "yearn";
appImageUrl?: string;
appName?: "Yearn";
canExchange?: boolean;
category?: VaultTokenMarketDataType;
decimals: number;
exchangeAddress?: Address;
fee?: number;
hide?: boolean;
img?: string;
implementation?: "factoryV2";
label?: string;
liquidity?: number;
network: "ethereum";
price: number;
protcolDisplay?: "Yearn";
reserve: number;
supply?: number;
symbol: string;
tokenImageUrl?: string;
tokens?: unknown[]; // it goes a few levels deep
type: VaultTokenMarketDataType;
volume?: number | null;
}