@aurigami/sdk 1.6.0-no-src → 1.6.0

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,247 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "inputs": [],
5
+ "payable": false,
6
+ "stateMutability": "nonpayable",
7
+ "type": "constructor"
8
+ },
9
+ {
10
+ "anonymous": false,
11
+ "inputs": [
12
+ {
13
+ "indexed": false,
14
+ "internalType": "address",
15
+ "name": "feed",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "indexed": false,
20
+ "internalType": "string",
21
+ "name": "symbol",
22
+ "type": "string"
23
+ }
24
+ ],
25
+ "name": "FeedSet",
26
+ "type": "event"
27
+ },
28
+ {
29
+ "anonymous": false,
30
+ "inputs": [
31
+ {
32
+ "indexed": false,
33
+ "internalType": "address",
34
+ "name": "oldAdmin",
35
+ "type": "address"
36
+ },
37
+ {
38
+ "indexed": false,
39
+ "internalType": "address",
40
+ "name": "newAdmin",
41
+ "type": "address"
42
+ }
43
+ ],
44
+ "name": "NewAdmin",
45
+ "type": "event"
46
+ },
47
+ {
48
+ "anonymous": false,
49
+ "inputs": [
50
+ {
51
+ "indexed": false,
52
+ "internalType": "address",
53
+ "name": "asset",
54
+ "type": "address"
55
+ },
56
+ {
57
+ "indexed": false,
58
+ "internalType": "uint256",
59
+ "name": "previousPriceMantissa",
60
+ "type": "uint256"
61
+ },
62
+ {
63
+ "indexed": false,
64
+ "internalType": "uint256",
65
+ "name": "requestedPriceMantissa",
66
+ "type": "uint256"
67
+ },
68
+ {
69
+ "indexed": false,
70
+ "internalType": "uint256",
71
+ "name": "newPriceMantissa",
72
+ "type": "uint256"
73
+ }
74
+ ],
75
+ "name": "PricePosted",
76
+ "type": "event"
77
+ },
78
+ {
79
+ "constant": true,
80
+ "inputs": [],
81
+ "name": "admin",
82
+ "outputs": [
83
+ {
84
+ "internalType": "address",
85
+ "name": "",
86
+ "type": "address"
87
+ }
88
+ ],
89
+ "payable": false,
90
+ "stateMutability": "view",
91
+ "type": "function"
92
+ },
93
+ {
94
+ "constant": true,
95
+ "inputs": [
96
+ {
97
+ "internalType": "address",
98
+ "name": "asset",
99
+ "type": "address"
100
+ }
101
+ ],
102
+ "name": "assetPrices",
103
+ "outputs": [
104
+ {
105
+ "internalType": "uint256",
106
+ "name": "",
107
+ "type": "uint256"
108
+ }
109
+ ],
110
+ "payable": false,
111
+ "stateMutability": "view",
112
+ "type": "function"
113
+ },
114
+ {
115
+ "constant": true,
116
+ "inputs": [
117
+ {
118
+ "internalType": "string",
119
+ "name": "symbol",
120
+ "type": "string"
121
+ }
122
+ ],
123
+ "name": "getFeed",
124
+ "outputs": [
125
+ {
126
+ "internalType": "contract AggregatorV2V3Interface",
127
+ "name": "",
128
+ "type": "address"
129
+ }
130
+ ],
131
+ "payable": false,
132
+ "stateMutability": "view",
133
+ "type": "function"
134
+ },
135
+ {
136
+ "constant": true,
137
+ "inputs": [
138
+ {
139
+ "internalType": "contract QiToken",
140
+ "name": "qiToken",
141
+ "type": "address"
142
+ }
143
+ ],
144
+ "name": "getUnderlyingPrice",
145
+ "outputs": [
146
+ {
147
+ "internalType": "uint256",
148
+ "name": "",
149
+ "type": "uint256"
150
+ }
151
+ ],
152
+ "payable": false,
153
+ "stateMutability": "view",
154
+ "type": "function"
155
+ },
156
+ {
157
+ "constant": true,
158
+ "inputs": [],
159
+ "name": "isPriceOracle",
160
+ "outputs": [
161
+ {
162
+ "internalType": "bool",
163
+ "name": "",
164
+ "type": "bool"
165
+ }
166
+ ],
167
+ "payable": false,
168
+ "stateMutability": "view",
169
+ "type": "function"
170
+ },
171
+ {
172
+ "constant": false,
173
+ "inputs": [
174
+ {
175
+ "internalType": "address",
176
+ "name": "newAdmin",
177
+ "type": "address"
178
+ }
179
+ ],
180
+ "name": "setAdmin",
181
+ "outputs": [],
182
+ "payable": false,
183
+ "stateMutability": "nonpayable",
184
+ "type": "function"
185
+ },
186
+ {
187
+ "constant": false,
188
+ "inputs": [
189
+ {
190
+ "internalType": "address",
191
+ "name": "asset",
192
+ "type": "address"
193
+ },
194
+ {
195
+ "internalType": "uint256",
196
+ "name": "price",
197
+ "type": "uint256"
198
+ }
199
+ ],
200
+ "name": "setDirectPrice",
201
+ "outputs": [],
202
+ "payable": false,
203
+ "stateMutability": "nonpayable",
204
+ "type": "function"
205
+ },
206
+ {
207
+ "constant": false,
208
+ "inputs": [
209
+ {
210
+ "internalType": "string",
211
+ "name": "symbol",
212
+ "type": "string"
213
+ },
214
+ {
215
+ "internalType": "address",
216
+ "name": "feed",
217
+ "type": "address"
218
+ }
219
+ ],
220
+ "name": "setFeed",
221
+ "outputs": [],
222
+ "payable": false,
223
+ "stateMutability": "nonpayable",
224
+ "type": "function"
225
+ },
226
+ {
227
+ "constant": false,
228
+ "inputs": [
229
+ {
230
+ "internalType": "contract QiToken",
231
+ "name": "qiToken",
232
+ "type": "address"
233
+ },
234
+ {
235
+ "internalType": "uint256",
236
+ "name": "underlyingPriceMantissa",
237
+ "type": "uint256"
238
+ }
239
+ ],
240
+ "name": "setUnderlyingPrice",
241
+ "outputs": [],
242
+ "payable": false,
243
+ "stateMutability": "nonpayable",
244
+ "type": "function"
245
+ }
246
+ ]
247
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "abi": []
3
+ }
@@ -0,0 +1,143 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { ethers, Signer, BigNumber as BN } from 'ethers';
3
+ import { MAINNET_ADDRESSES } from './deployments';
4
+ export const dummyAddress: string =
5
+ '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
6
+ export const ETHAddress: string = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
7
+
8
+ export const AURORA_CHAINID = 1313161554;
9
+
10
+ export const DECIMAL_PRECISION = 10;
11
+
12
+ export type NetworkAddresses = {
13
+ auTokens: {
14
+ name: string;
15
+ address: string;
16
+ underlying: string;
17
+ }[];
18
+ misc: Record<string, string>;
19
+ tokens: Record<string, string>;
20
+ };
21
+ export const networkAddresses: NetworkAddresses = {
22
+ auTokens: [
23
+ {
24
+ name: 'auUSDC',
25
+ address: MAINNET_ADDRESSES.auTokens.USDC.toLowerCase(),
26
+ underlying: '0xb12bfca5a55806aaf64e99521918a4bf0fc40802'.toLowerCase(),
27
+ },
28
+ {
29
+ name: 'auETH',
30
+ address: MAINNET_ADDRESSES.auTokens.ETH.toLowerCase(),
31
+ underlying: ETHAddress.toLowerCase(),
32
+ },
33
+ {
34
+ name: 'auWBTC',
35
+ address: MAINNET_ADDRESSES.auTokens.WBTC.toLowerCase(),
36
+ underlying: '0xf4eb217ba2454613b15dbdea6e5f22276410e89e'.toLowerCase(),
37
+ },
38
+ {
39
+ name: 'auUSDT',
40
+ address: MAINNET_ADDRESSES.auTokens.USDT.toLowerCase(),
41
+ underlying: '0x4988a896b1227218e4a686fde5eabdcabd91571f'.toLowerCase(),
42
+ },
43
+ {
44
+ name: 'auDAI',
45
+ address: MAINNET_ADDRESSES.auTokens.DAI.toLowerCase(),
46
+ underlying: '0xe3520349f477a5f6eb06107066048508498a291b'.toLowerCase(),
47
+ },
48
+ {
49
+ name: 'auWNEAR',
50
+ address: MAINNET_ADDRESSES.auTokens.WNEAR.toLowerCase(),
51
+ underlying: '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d'.toLowerCase(),
52
+ },
53
+ {
54
+ name: 'auSTNEAR',
55
+ address: MAINNET_ADDRESSES.auTokens.STNEAR.toLowerCase(),
56
+ underlying: '0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30'.toLowerCase(),
57
+ },
58
+ {
59
+ name: 'auAURORA',
60
+ address: MAINNET_ADDRESSES.auTokens.AURORA.toLowerCase(),
61
+ underlying: '0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
62
+ },
63
+ {
64
+ name: 'auTRI',
65
+ address: MAINNET_ADDRESSES.auTokens.TRI.toLowerCase(),
66
+ underlying: '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
67
+ },
68
+ {
69
+ name: 'auPLY',
70
+ address: MAINNET_ADDRESSES.auTokens.PLY.toLowerCase(),
71
+ underlying: '0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase(),
72
+ },
73
+ ],
74
+ misc: {
75
+ COMPTROLLER: MAINNET_ADDRESSES.comptroller.toLowerCase(),
76
+ oracle: MAINNET_ADDRESSES.oracle.toLowerCase(),
77
+ AURIFAIRLAUNCH: MAINNET_ADDRESSES.fairLaunch.toLowerCase(),
78
+ AURILENS: MAINNET_ADDRESSES.auriLens.toLowerCase(),
79
+ ETHREPAYHELPER: MAINNET_ADDRESSES.ethRepayHelper.toLowerCase(),
80
+ AURI_AIRDROP: MAINNET_ADDRESSES.auriAirdrop.toLowerCase(),
81
+ },
82
+ tokens: {
83
+ AURORA: '0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
84
+ PLY: '0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase(),
85
+ stNEAR: '0x07f9f7f963c5cd2bbffd30ccfb964be114332e30'.toLowerCase(),
86
+ USDC: '0xb12bfca5a55806aaf64e99521918a4bf0fc40802'.toLowerCase(),
87
+ WNEAR: '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d'.toLowerCase(),
88
+ TRI: '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
89
+ META: '0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLocaleLowerCase(),
90
+ PULP: MAINNET_ADDRESSES.PULP.toLowerCase(),
91
+ PLYWNEAR: MAINNET_ADDRESSES.ply_wnear_lp.toLowerCase(),
92
+ },
93
+ };
94
+
95
+ // All token that we can calculate the price via oracle + coingecko
96
+ export const PRICE_WHITELISTED = new Set([
97
+ ...networkAddresses.auTokens.map((t) => t.underlying),
98
+ networkAddresses.tokens.AURORA,
99
+ networkAddresses.tokens.TRI,
100
+ networkAddresses.tokens.META,
101
+ networkAddresses.tokens.stNEAR,
102
+ ]);
103
+
104
+ export const REWARD_CLAIM_START = 1651759200; // Thursday, 5 May 2022 14:00:00 UTC
105
+
106
+ export const BORROW_LIMIT_BUFFER = new BigNumber(1);
107
+
108
+ export const ONE_DAY = 86400;
109
+ export const ONE_WEEK = ONE_DAY * 7;
110
+ export const ONE_YEAR = ONE_DAY * 365;
111
+
112
+ export const PLYWNEAR_POOL_ID = 0;
113
+ export const PLYWNEAR_REWARD_TOKENS = [
114
+ '0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', // PLY
115
+ '0x04Ac48711BCdc45b4d223fb021E09DA73c71095e', // PULP
116
+ '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', // WNEAR
117
+ '0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30', // STNEAR
118
+ '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', // AURORA
119
+ '0xFa94348467f64D5A457F75F8bc40495D33c65aBB', // TRI
120
+ ];
121
+ // could call RPC to get all the staking pools but it's not necessary for now
122
+ export const ALL_STAKING_POOLS: number[] = [PLYWNEAR_POOL_ID];
123
+ export const INF = BN.from(2).pow(256).sub(1);
124
+
125
+ export const AIRDROP_START_TIMESTAMP = 1649858400;
126
+ export const AIRDROP_END_TIMESTAMP = 1651068000;
127
+ export const AIRDROP_KEEP_THRESHOLD = 7 * 86400;
128
+
129
+ export const DEPOSIT_NEAR_REWARDS_PER_WEEK: { [k: string]: string } =
130
+ Object.fromEntries(
131
+ // lower case all addresses
132
+ Object.entries({
133
+ '0xb12bfca5a55806aaf64e99521918a4bf0fc40802': '36375', // USDC
134
+ '0x4988a896b1227218e4a686fde5eabdcabd91571f': '14550', // USDT
135
+ '0xf4eb217ba2454613b15dbdea6e5f22276410e89e': '3638', // WBTC
136
+ '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': '14550', // ETH
137
+ '0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d': '3638', // WNEAR
138
+ }).map(([k, v]) => [k.toLowerCase(), v])
139
+ );
140
+
141
+ export const BORROW_NEAR_REWARDS_PER_WEEK: { [k: string]: string } = {
142
+ // currently 0 for all markets
143
+ };
@@ -0,0 +1,24 @@
1
+ export const decimalRecords: Record<string, number> = {
2
+ '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
3
+ '0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f': 18,
4
+ '0x3195949f267702723bc614cae037cdc8d1e94786': 8,
5
+ '0xfa94348467f64d5a457f75f8bc40495d33c65abb': 18,
6
+ '0x07f9f7f963c5cd2bbffd30ccfb964be114332e30': 24,
7
+ '0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d': 24,
8
+ '0x6ea6c03061bddce23d4ec60b6e6e880c33d24dca': 8,
9
+ '0xca9511b610ba5fc7e311fdef9ce16050ee4449e9': 8,
10
+ '0x8bec47865ade3b172a928df8f990bc7f2a3b9f79': 18,
11
+ '0xcfb6b0498cb7555e7e21502e0f449bf28760adbb': 8,
12
+ '0x4f0d864b1abf4b701799a0b30b57a22dfeb5917b': 8,
13
+ '0xad5a2437ff55ed7a8cad3b797b3ec7c5a19b1c54': 8,
14
+ '0x4988a896b1227218e4a686fde5eabdcabd91571f': 6,
15
+ '0xb12bfca5a55806aaf64e99521918a4bf0fc40802': 6,
16
+ '0xe3520349f477a5f6eb06107066048508498a291b': 18,
17
+ '0x8888682e24dd4df7b7ff2b91fccb575737e433bf': 8,
18
+ '0xae4fac24dcdae0132c6d04f564dcf059616e9423': 8,
19
+ '0xce4166363e3a584dac84a47bcd3414b43efcdd1c': 8,
20
+ '0xf4eb217ba2454613b15dbdea6e5f22276410e89e': 8,
21
+ '0xc21ff01229e982d7c8b8691163b0a3cb8f357453': 24,
22
+ '0x04ac48711bcdc45b4d223fb021e09da73c71095e': 18, // PULP
23
+ '0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18, // PLYWNEAR
24
+ };
@@ -0,0 +1,4 @@
1
+ import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
2
+ import TESTNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_testnet.json';
3
+
4
+ export { MAINNET_ADDRESSES, TESTNET_ADDRESSES };
@@ -0,0 +1,38 @@
1
+ import { Token } from '../entities';
2
+ import { TokenAmount } from '../entities';
3
+ import { UserMarketDetails } from '../types';
4
+
5
+ export const dummyToken = new Token(
6
+ '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
7
+ 6
8
+ );
9
+
10
+ export const dummyPly = new Token(
11
+ '0x8729438eb15e2c8b576fcc6aecda6a148776c0f5',
12
+ 18
13
+ );
14
+
15
+ export const dummyPlyAurora = new Token(
16
+ '0xE530dC2095Ef5653205CF5ea79F8979a7028065c',
17
+ 18
18
+ );
19
+
20
+ export const dummyTokenAmount = new TokenAmount(dummyToken, '123.456', false);
21
+
22
+ export const dummyZeroTokenAmount = new TokenAmount(dummyToken, '0');
23
+
24
+ export const dummyTokenAmount2 = new TokenAmount(dummyToken, '456.123', false);
25
+
26
+ export const dummyTokenAmount3 = new TokenAmount(dummyToken, '1000.123', false);
27
+
28
+ export const dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f'; // qiUSDC
29
+
30
+ export const dummyUserMarketDetails: UserMarketDetails = {
31
+ market: dummyMarketAddress,
32
+ depositBalance: dummyTokenAmount2,
33
+ borrowBalance: dummyZeroTokenAmount,
34
+ isCollateral: true,
35
+ maxWithdrawableAmount: dummyTokenAmount,
36
+ collateralRatio: 0.5,
37
+ underlyingPrice: '1',
38
+ };
@@ -0,0 +1,4 @@
1
+ export * from './constants';
2
+ export * from './decimals';
3
+ export * from './dummy';
4
+ export * from './deployments';