@aurigami/sdk 1.5.3 → 1.5.5
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/dist/constants.d.ts +1 -1
- package/dist/helpers.d.ts +1 -0
- package/dist/priceFetcher.d.ts +1 -0
- package/dist/sdk.cjs.development.js +86 -41
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +85 -42
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -5
- package/src/airdrop-lottery.ts +1 -1
- package/src/constants.ts +10 -3
- package/src/deployments/aurora_mainnet.json +4 -3
- package/src/helpers.ts +7 -1
- package/src/priceFetcher.ts +14 -3
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
2
|
+
"version": "1.5.5",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -40,9 +40,6 @@
|
|
|
40
40
|
"limit": "10 KB"
|
|
41
41
|
}
|
|
42
42
|
],
|
|
43
|
-
"browser": {
|
|
44
|
-
"assert": false
|
|
45
|
-
},
|
|
46
43
|
"devDependencies": {
|
|
47
44
|
"@size-limit/preset-small-lib": "^7.0.5",
|
|
48
45
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -55,7 +52,7 @@
|
|
|
55
52
|
"typescript": "^4.5.4"
|
|
56
53
|
},
|
|
57
54
|
"dependencies": {
|
|
58
|
-
"@aurigami/contracts": "3.
|
|
55
|
+
"@aurigami/contracts": "3.3.0",
|
|
59
56
|
"@nomiclabs/hardhat-ethers": "^2.0.5",
|
|
60
57
|
"@nomiclabs/hardhat-etherscan": "^3.0.3",
|
|
61
58
|
"@nomiclabs/hardhat-waffle": "^2.0.3",
|
package/src/airdrop-lottery.ts
CHANGED
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
getCurrentTimestamp,
|
|
17
17
|
getDecimal,
|
|
18
18
|
isSameAddress,
|
|
19
|
+
assert,
|
|
19
20
|
} from './helpers';
|
|
20
21
|
import AIRDROP_AUTOKEN_INFO from './airdrop_misc/auTokensInfo.json';
|
|
21
22
|
import AIRDROP_WHITELIST_ADDRESSES from './airdrop_misc/whitelist.json';
|
|
22
23
|
import { AuriAirdrop } from '@aurigami/contracts/typechain';
|
|
23
|
-
import assert from 'assert';
|
|
24
24
|
import { TokenAmount } from './tokenAmount';
|
|
25
25
|
import { Token } from './token';
|
|
26
26
|
|
package/src/constants.ts
CHANGED
|
@@ -64,11 +64,16 @@ export const networkAddresses: NetworkAddresses = {
|
|
|
64
64
|
address: '0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca'.toLowerCase(),
|
|
65
65
|
underlying: '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
|
|
66
66
|
},
|
|
67
|
+
{
|
|
68
|
+
name: 'auPLY',
|
|
69
|
+
address: '0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c'.toLowerCase(),
|
|
70
|
+
underlying: '0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase(),
|
|
71
|
+
},
|
|
67
72
|
],
|
|
68
73
|
misc: {
|
|
69
74
|
COMPTROLLER: '0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb'.toLowerCase(),
|
|
70
75
|
oracle: '0xC6e5185438e1730959c1eF3551059A3feC744E90'.toLowerCase(),
|
|
71
|
-
AURIFAIRLAUNCH: '
|
|
76
|
+
AURIFAIRLAUNCH: '0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2'.toLowerCase(),
|
|
72
77
|
AURILENS: '0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70'.toLowerCase(),
|
|
73
78
|
TOKENLOCK: '0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
|
|
74
79
|
ETHREPAYHELPER: '0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6'.toLowerCase(),
|
|
@@ -83,7 +88,7 @@ export const networkAddresses: NetworkAddresses = {
|
|
|
83
88
|
TRI: '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
|
|
84
89
|
META: '0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLocaleLowerCase(),
|
|
85
90
|
PULP: '0x04Ac48711BCdc45b4d223fb021E09DA73c71095e'.toLowerCase(),
|
|
86
|
-
PLYWNEAR: '0x044b6B0CD3Bb13D2b9057781Df4459C66781dCe7'.toLowerCase(),
|
|
91
|
+
PLYWNEAR: '0x044b6B0CD3Bb13D2b9057781Df4459C66781dCe7'.toLowerCase(),
|
|
87
92
|
},
|
|
88
93
|
};
|
|
89
94
|
|
|
@@ -96,7 +101,7 @@ export const PRICE_WHITELISTED = new Set([
|
|
|
96
101
|
networkAddresses.tokens.stNEAR,
|
|
97
102
|
]);
|
|
98
103
|
|
|
99
|
-
export const REWARD_CLAIM_START =
|
|
104
|
+
export const REWARD_CLAIM_START = 1651759200; // Thursday, 5 May 2022 14:00:00 UTC
|
|
100
105
|
|
|
101
106
|
export const BORROW_LIMIT_BUFFER = new BigNumber(1);
|
|
102
107
|
|
|
@@ -107,7 +112,9 @@ export const ONE_YEAR = ONE_DAY * 365;
|
|
|
107
112
|
export const PLYWNEAR_POOL_ID = 0;
|
|
108
113
|
export const PLYWNEAR_REWARD_TOKENS = [
|
|
109
114
|
'0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', // PLY
|
|
115
|
+
'0x04Ac48711BCdc45b4d223fb021E09DA73c71095e', // PULP
|
|
110
116
|
'0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', // WNEAR
|
|
117
|
+
'0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30', // STNEAR
|
|
111
118
|
'0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', // AURORA
|
|
112
119
|
'0xFa94348467f64D5A457F75F8bc40495D33c65aBB', // TRI
|
|
113
120
|
];
|
|
@@ -15,16 +15,17 @@
|
|
|
15
15
|
"WNEAR": "0xaE4fac24dCdAE0132C6d04f564dCf059616E9423",
|
|
16
16
|
"STNEAR": "0x3195949f267702723bc614cAE037cdc8D1E94786",
|
|
17
17
|
"AURORA": "0x8888682E24dd4Df7B7Ff2B91fccB575737E433bf",
|
|
18
|
-
"TRI": "0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca"
|
|
18
|
+
"TRI": "0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca",
|
|
19
|
+
"PLY": "0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c"
|
|
19
20
|
},
|
|
20
|
-
"fairLaunch": "
|
|
21
|
+
"fairLaunch": "0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2",
|
|
21
22
|
"auriLens": "0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70",
|
|
22
|
-
"auriLensImpl": "0x5Dd06745574b6E40F53E90468e5866fFB37173a0",
|
|
23
23
|
"ethRepayHelper": "0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6",
|
|
24
24
|
"configReader": "0x347B321c466663D6A0fE9C0ccfCF8cEa86F8ecD3",
|
|
25
25
|
"auriAirdropImpl": "0x94cdA0Da833b384B901d33D5c56FccDE21D5E6e7",
|
|
26
26
|
"auriAirdrop": "0x6C42aA5b128B62D6CCf357726D7d13F3888335EC",
|
|
27
27
|
"ply_wnear_lp": "0x044b6B0CD3Bb13D2b9057781Df4459C66781dCe7",
|
|
28
28
|
"PULP": "0x04Ac48711BCdc45b4d223fb021E09DA73c71095e",
|
|
29
|
+
"plyTokenLock": "0x5715C45D2C82292D8e5961Eb5e2C66fe0Fc5412B",
|
|
29
30
|
"test": {}
|
|
30
31
|
}
|
package/src/helpers.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
|
-
import assert from 'assert';
|
|
3
2
|
import BigNumber from 'bignumber.js';
|
|
4
3
|
import { BigNumber as BN, utils } from 'ethers';
|
|
5
4
|
import { getQuery as getAuroraAPIQuery } from './aurora-api-helpers';
|
|
6
5
|
import { decimalRecords } from './decimals';
|
|
7
6
|
import { Address } from './types';
|
|
8
7
|
|
|
8
|
+
export function assert(condition: boolean, message: string = ''): void {
|
|
9
|
+
if (!condition) {
|
|
10
|
+
message = 'Assertion failed' + (message ? ': ' + message : '');
|
|
11
|
+
throw new Error(message);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
export function formatObject(object: Object) {
|
|
10
16
|
return JSON.stringify(object, null, ' ');
|
|
11
17
|
}
|
package/src/priceFetcher.ts
CHANGED
|
@@ -6,14 +6,13 @@ import {
|
|
|
6
6
|
PRICE_WHITELISTED,
|
|
7
7
|
} from './constants';
|
|
8
8
|
import OracleABI from './abis/Oracle.json';
|
|
9
|
-
import { isSameAddress, decimalFactor, getDecimal } from './helpers';
|
|
9
|
+
import { isSameAddress, decimalFactor, getDecimal, assert } from './helpers';
|
|
10
10
|
import { IUniswapV2Pair, PriceOracle } from '@aurigami/contracts/typechain';
|
|
11
11
|
import { TokenAmount } from './tokenAmount';
|
|
12
12
|
import { Address, TokenValuation } from './types';
|
|
13
13
|
import IUniswapV2PairABI from './abis/IUniswapV2Pair.json';
|
|
14
14
|
import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
15
15
|
import axios from 'axios';
|
|
16
|
-
import assert from 'assert';
|
|
17
16
|
|
|
18
17
|
const hardcodePLYPrice = true;
|
|
19
18
|
export async function fetchPriceFromCoingeckoAPI(
|
|
@@ -207,7 +206,10 @@ async function _fetchPrice(
|
|
|
207
206
|
address: Address,
|
|
208
207
|
provider: providers.Provider
|
|
209
208
|
): Promise<BigNumber> {
|
|
210
|
-
assert(
|
|
209
|
+
assert(
|
|
210
|
+
PRICE_WHITELISTED.has(address.toLocaleLowerCase()),
|
|
211
|
+
`Address ${address} is not whitelisted for price fetching`
|
|
212
|
+
);
|
|
211
213
|
|
|
212
214
|
if (isSameAddress(address, networkAddresses.tokens.stNEAR))
|
|
213
215
|
return fetchStNEARPrice();
|
|
@@ -237,6 +239,8 @@ export async function fetchPrice(
|
|
|
237
239
|
return fetchLPPrice(address, provider);
|
|
238
240
|
} else if (isSameAddress(address, networkAddresses.tokens.PLY)) {
|
|
239
241
|
return fetchPLYPrice(provider);
|
|
242
|
+
} else if (isSameAddress(address, networkAddresses.tokens.PULP)) {
|
|
243
|
+
return fetchPULPPrice(provider);
|
|
240
244
|
}
|
|
241
245
|
return _fetchPrice(address, provider);
|
|
242
246
|
}
|
|
@@ -248,6 +252,13 @@ export async function fetchPLYPrice(
|
|
|
248
252
|
return fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider);
|
|
249
253
|
}
|
|
250
254
|
|
|
255
|
+
export async function fetchPULPPrice(
|
|
256
|
+
provider: providers.Provider
|
|
257
|
+
): Promise<BigNumber> {
|
|
258
|
+
//TODO: Calculate PULP price
|
|
259
|
+
return new BigNumber(0);
|
|
260
|
+
}
|
|
261
|
+
|
|
251
262
|
export async function fetchToken0PriceByLP(
|
|
252
263
|
LP: Address,
|
|
253
264
|
provider: providers.Provider
|