/
index.ts
153 lines (133 loc) · 3.63 KB
/
index.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import daiLogo from "../assets/icons/dai.svg"
import saddleLogo from "../assets/icons/logo.svg"
import usdcLogo from "../assets/icons/usdc.svg"
import usdtLogo from "../assets/icons/usdt.svg"
export const NetworkContextName = "NETWORK"
export const STABLECOIN_POOL_NAME = "Stablecoin Pool"
export type PoolName = typeof STABLECOIN_POOL_NAME
export const GAS_PRICE = 470
export enum ChainId {
AVALANCHE = 1,
// ROPSTEN = 3,
// RINKEBY = 4,
// GÖRLI = 5,
// KOVAN = 42,
FUJI = 43113,
}
export class Token {
readonly addresses: { [chainId in ChainId]: string }
readonly decimals: number
readonly symbol: string
readonly name: string
readonly icon: string
readonly geckoId: string
constructor(
addresses: { [chainId in ChainId]: string },
decimals: number,
symbol: string,
geckoId: string,
name: string,
icon: string,
) {
this.addresses = addresses
this.decimals = decimals
this.symbol = symbol
this.geckoId = geckoId
this.name = name
this.icon = icon
}
}
export const BLOCK_TIME = 3000
export const STABLECOIN_SWAP_ADDRESSES: { [chainId in ChainId]: string } = {
[ChainId.AVALANCHE]: "0x4f6A43Ad7cba042606dECaCA730d4CE0A57ac62e",
[ChainId.FUJI]: "0xa818a4E693132CFf3E9677474a1F57f0F7D2fe8d",
}
export const MERKLETREE_DATA: { [chainId in ChainId]: string } = {
[ChainId.AVALANCHE]: "AVALANCHETestAccounts.json",
[ChainId.FUJI]: "FUJI.json",
}
export const STABLECOIN_SWAP_TOKEN_CONTRACT_ADDRESSES: {
[chainId in ChainId]: string
} = {
[ChainId.AVALANCHE]: "",
[ChainId.FUJI]: "0x748e67353306b3183E8Bc9C27fE60a017E99d4D4",
}
export const STABLECOIN_SWAP_TOKEN = new Token(
STABLECOIN_SWAP_TOKEN_CONTRACT_ADDRESSES,
18,
"saddleUSD",
"saddleusd",
"Saddle DAI/USDC/USDT",
saddleLogo,
)
// Stablecoins
const DAI_CONTRACT_ADDRESSES: { [chainId in ChainId]: string } = {
[ChainId.AVALANCHE]: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
[ChainId.FUJI]: "0xBF967f44dB44380CD38B76AaD850f8B2f98a29aD",
}
export const DAI = new Token(
DAI_CONTRACT_ADDRESSES,
18,
"DAI",
"dai",
"Dai",
daiLogo,
)
const USDC_CONTRACT_ADDRESSES: { [chainId in ChainId]: string } = {
[ChainId.AVALANCHE]: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
[ChainId.FUJI]: "0x6275B63A4eE560004c34431e573314426906cee9",
}
export const USDC = new Token(
USDC_CONTRACT_ADDRESSES,
6,
"USDC",
"usd-coin",
"USDC Coin",
usdcLogo,
)
const USDT_CONTRACT_ADDRESSES: { [chainId in ChainId]: string } = {
[ChainId.AVALANCHE]: "0xdac17f958d2ee523a2206206994597c13d831ec7",
[ChainId.FUJI]: "0xa6c062F1F8EAbEC4384bB2c2f65abBf710cd2998",
}
export const USDT = new Token(
USDT_CONTRACT_ADDRESSES,
6,
"USDT",
"tether",
"Tether",
usdtLogo,
)
export const STABLECOIN_POOL_TOKENS = [DAI, USDC, USDT]
// maps a symbol string to a token object
export const TOKENS_MAP: {
[symbol: string]: Token
} = STABLECOIN_POOL_TOKENS.reduce(
(acc, token) => ({ ...acc, [token.symbol]: token }),
{},
)
export const POOLS_MAP: {
[poolName in PoolName]: {
lpToken: Token
poolTokens: Token[]
}
} = {
[STABLECOIN_POOL_NAME]: {
lpToken: STABLECOIN_SWAP_TOKEN,
poolTokens: STABLECOIN_POOL_TOKENS,
},
}
export const TRANSACTION_TYPES = {
DEPOSIT: "DEPOSIT",
WITHDRAW: "WITHDRAW",
SWAP: "SWAP",
}
export const POOL_FEE_PRECISION = 10
export const DEPLOYED_BLOCK: { [chainId in ChainId]: number } = {
[ChainId.AVALANCHE]: 11656944,
[ChainId.FUJI]: 10000,
}
export const POOL_STATS_URL: { [chainId in ChainId]: string } = {
[ChainId.AVALANCHE]: "https://ipfs.saddle.exchange/pool-stats.json",
[ChainId.FUJI]:
"https://mehmeta-team-bucket.storage.fleek.co/pool-stats-dev.json",
}