@aurigami/sdk 1.5.9 → 1.6.0-no-src
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/SDK.d.ts +23 -16
- package/dist/consts/deployments.d.ts +3 -0
- package/dist/{dummy.d.ts → consts/dummy.d.ts} +3 -3
- package/dist/consts/index.d.ts +4 -0
- package/dist/{MoneyMarket.d.ts → contracts/MoneyMarket.d.ts} +3 -5
- package/dist/{Papermill.d.ts → contracts/Papermill.d.ts} +25 -4
- package/dist/{Staking.d.ts → contracts/Staking.d.ts} +8 -3
- package/dist/{airdrop-lottery.d.ts → contracts/airdrop-lottery.d.ts} +12 -4
- package/dist/contracts/index.d.ts +4 -0
- package/dist/{BlockchainEntity.d.ts → entities/BlockchainEntity.d.ts} +1 -1
- package/dist/entities/index.d.ts +3 -0
- package/dist/{tokenAmount.d.ts → entities/tokenAmount.d.ts} +1 -1
- package/dist/{helpers.d.ts → helpers/helpers.d.ts} +10 -1
- package/dist/helpers/index.d.ts +4 -0
- package/dist/{priceFetcher.d.ts → helpers/priceFetcher.d.ts} +2 -2
- package/dist/{transfer-event-query.d.ts → helpers/transfer-event-query.d.ts} +11 -2
- package/dist/index.d.ts +4 -11
- package/dist/sdk.cjs.development.js +2007 -104379
- 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 +2004 -104383
- package/dist/sdk.esm.js.map +1 -1
- package/dist/{types.d.ts → types/index.d.ts} +15 -1
- package/package.json +12 -13
- package/src/BlockchainEntity.ts +0 -33
- package/src/MoneyMarket.ts +0 -510
- package/src/Papermill.ts +0 -262
- package/src/SDK.ts +0 -366
- package/src/Staking.ts +0 -174
- package/src/abis/Faucet.json +0 -157
- package/src/abis/IUniswapV2Pair.json +0 -663
- package/src/abis/Oracle.json +0 -247
- package/src/abis/dummy.json +0 -3
- package/src/airdrop-lottery.ts +0 -327
- package/src/airdrop_misc/auTokensInfo.json +0 -34
- package/src/airdrop_misc/whitelist.example.txt +0 -4
- package/src/airdrop_misc/whitelist.json +0 -102629
- package/src/aurora-api-helpers.ts +0 -20
- package/src/constants.ts +0 -143
- package/src/decimals.ts +0 -24
- package/src/deployments/aurora_mainnet.json +0 -31
- package/src/deployments/aurora_testnet.json +0 -31
- package/src/dummy.ts +0 -38
- package/src/helpers.ts +0 -91
- package/src/index.ts +0 -20
- package/src/priceFetcher.ts +0 -309
- package/src/token.ts +0 -21
- package/src/tokenAmount.ts +0 -42
- package/src/transfer-event-query.ts +0 -70
- package/src/types.ts +0 -106
- /package/dist/{constants.d.ts → consts/constants.d.ts} +0 -0
- /package/dist/{decimals.d.ts → consts/decimals.d.ts} +0 -0
- /package/dist/{token.d.ts → entities/token.d.ts} +0 -0
- /package/dist/{aurora-api-helpers.d.ts → helpers/aurora-api-helpers.d.ts} +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
|
|
3
|
-
const AURORA_API_BASE_URL = 'https://api.aurorascan.dev/api';
|
|
4
|
-
|
|
5
|
-
export async function getQuery(
|
|
6
|
-
module: string,
|
|
7
|
-
action: string,
|
|
8
|
-
params: Record<string, any> = {}
|
|
9
|
-
): Promise<any> {
|
|
10
|
-
params = { ...params, module: module, action: action };
|
|
11
|
-
|
|
12
|
-
let resp = await axios.get(
|
|
13
|
-
AURORA_API_BASE_URL + '?' + new URLSearchParams(params),
|
|
14
|
-
{
|
|
15
|
-
headers: { 'Content-Type': 'application/json' },
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
return resp.data.result!;
|
|
20
|
-
}
|
package/src/constants.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { ethers, Signer, BigNumber as BN } from 'ethers';
|
|
3
|
-
export const dummyAddress: string =
|
|
4
|
-
'0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
|
|
5
|
-
export const ETHAddress: string = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
6
|
-
|
|
7
|
-
export const AURORA_CHAINID = 1313161554;
|
|
8
|
-
|
|
9
|
-
export const DECIMAL_PRECISION = 10;
|
|
10
|
-
|
|
11
|
-
export type NetworkAddresses = {
|
|
12
|
-
auTokens: {
|
|
13
|
-
name: string;
|
|
14
|
-
address: string;
|
|
15
|
-
underlying: string;
|
|
16
|
-
}[];
|
|
17
|
-
misc: Record<string, string>;
|
|
18
|
-
tokens: Record<string, string>;
|
|
19
|
-
};
|
|
20
|
-
export const networkAddresses: NetworkAddresses = {
|
|
21
|
-
auTokens: [
|
|
22
|
-
{
|
|
23
|
-
name: 'auUSDC',
|
|
24
|
-
address: '0x4f0d864b1ABf4B701799a0b30b57A22dFEB5917b'.toLowerCase(),
|
|
25
|
-
underlying: '0xb12bfca5a55806aaf64e99521918a4bf0fc40802'.toLowerCase(),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'auETH',
|
|
29
|
-
address: '0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9'.toLowerCase(),
|
|
30
|
-
underlying: ETHAddress.toLowerCase(),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'auWBTC',
|
|
34
|
-
address: '0xCFb6b0498cb7555e7e21502E0F449bf28760Adbb'.toLowerCase(),
|
|
35
|
-
underlying: '0xf4eb217ba2454613b15dbdea6e5f22276410e89e'.toLowerCase(),
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'auUSDT',
|
|
39
|
-
address: '0xaD5A2437Ff55ed7A8Cad3b797b3eC7c5a19B1c54'.toLowerCase(),
|
|
40
|
-
underlying: '0x4988a896b1227218e4a686fde5eabdcabd91571f'.toLowerCase(),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: 'auDAI',
|
|
44
|
-
address: '0xCE4166363E3a584DAc84A47bCD3414B43EfCDd1c'.toLowerCase(),
|
|
45
|
-
underlying: '0xe3520349f477a5f6eb06107066048508498a291b'.toLowerCase(),
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'auWNEAR',
|
|
49
|
-
address: '0xaE4fac24dCdAE0132C6d04f564dCf059616E9423'.toLowerCase(),
|
|
50
|
-
underlying: '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d'.toLowerCase(),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'auSTNEAR',
|
|
54
|
-
address: '0x3195949f267702723bc614cAE037cdc8D1E94786'.toLowerCase(),
|
|
55
|
-
underlying: '0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30'.toLowerCase(),
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'auAURORA',
|
|
59
|
-
address: '0x8888682E24dd4Df7B7Ff2B91fccB575737E433bf'.toLowerCase(),
|
|
60
|
-
underlying: '0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: 'auTRI',
|
|
64
|
-
address: '0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca'.toLowerCase(),
|
|
65
|
-
underlying: '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: 'auPLY',
|
|
69
|
-
address: '0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c'.toLowerCase(),
|
|
70
|
-
underlying: '0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase(),
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
misc: {
|
|
74
|
-
COMPTROLLER: '0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb'.toLowerCase(),
|
|
75
|
-
oracle: '0xC6e5185438e1730959c1eF3551059A3feC744E90'.toLowerCase(),
|
|
76
|
-
AURIFAIRLAUNCH: '0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2'.toLowerCase(),
|
|
77
|
-
AURILENS: '0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70'.toLowerCase(),
|
|
78
|
-
TOKENLOCK: '0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
|
|
79
|
-
ETHREPAYHELPER: '0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6'.toLowerCase(),
|
|
80
|
-
AURI_AIRDROP: '0x6C42aA5b128B62D6CCf357726D7d13F3888335EC'.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: '0x04Ac48711BCdc45b4d223fb021E09DA73c71095e'.toLowerCase(),
|
|
91
|
-
PLYWNEAR: '0x044b6B0CD3Bb13D2b9057781Df4459C66781dCe7'.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
|
-
};
|
package/src/decimals.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"deployer": "0xb969526EBc8dd4b1d816Da846eE08180515fFBbC",
|
|
3
|
-
"unitroller": "0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb",
|
|
4
|
-
"comptrollerImpl": "0x559c68b1276d070CB9d6Da75ECeA90FFB6497b18",
|
|
5
|
-
"comptroller": "0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb",
|
|
6
|
-
"PLY": "0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f",
|
|
7
|
-
"jumpRateModel": "0x0Bc03bd8d4aF1e8bab2194860268F5774C9d400a",
|
|
8
|
-
"oracle": "0xC6e5185438e1730959c1eF3551059A3feC744E90",
|
|
9
|
-
"auTokens": {
|
|
10
|
-
"USDC": "0x4f0d864b1ABf4B701799a0b30b57A22dFEB5917b",
|
|
11
|
-
"ETH": "0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9",
|
|
12
|
-
"WBTC": "0xCFb6b0498cb7555e7e21502E0F449bf28760Adbb",
|
|
13
|
-
"USDT": "0xaD5A2437Ff55ed7A8Cad3b797b3eC7c5a19B1c54",
|
|
14
|
-
"DAI": "0xCE4166363E3a584DAc84A47bCD3414B43EfCDd1c",
|
|
15
|
-
"WNEAR": "0xaE4fac24dCdAE0132C6d04f564dCf059616E9423",
|
|
16
|
-
"STNEAR": "0x3195949f267702723bc614cAE037cdc8D1E94786",
|
|
17
|
-
"AURORA": "0x8888682E24dd4Df7B7Ff2B91fccB575737E433bf",
|
|
18
|
-
"TRI": "0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca",
|
|
19
|
-
"PLY": "0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c"
|
|
20
|
-
},
|
|
21
|
-
"fairLaunch": "0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2",
|
|
22
|
-
"auriLens": "0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70",
|
|
23
|
-
"ethRepayHelper": "0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6",
|
|
24
|
-
"configReader": "0x347B321c466663D6A0fE9C0ccfCF8cEa86F8ecD3",
|
|
25
|
-
"auriAirdropImpl": "0x94cdA0Da833b384B901d33D5c56FccDE21D5E6e7",
|
|
26
|
-
"auriAirdrop": "0x6C42aA5b128B62D6CCf357726D7d13F3888335EC",
|
|
27
|
-
"ply_wnear_lp": "0x044b6B0CD3Bb13D2b9057781Df4459C66781dCe7",
|
|
28
|
-
"PULP": "0x04Ac48711BCdc45b4d223fb021E09DA73c71095e",
|
|
29
|
-
"plyTokenLock": "0x5715C45D2C82292D8e5961Eb5e2C66fe0Fc5412B",
|
|
30
|
-
"test": {}
|
|
31
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"networkId": 1313161555,
|
|
3
|
-
"deployer": "0x42D2D78Cc14e1B7D5e317B42e5335D8816B4Fd3F",
|
|
4
|
-
"unitroller": "0x1626d7941DF19781657a921014597c449F86941e",
|
|
5
|
-
"comptroller": "0x06200C8331193241e6487235C1E8a1340fcc9C1A",
|
|
6
|
-
"ply": "0x84B5C41DC786316c5aA319B5A22CA77472e1d31f",
|
|
7
|
-
"tokenLock": "0xc77E562C41ec3Ce860b5424758B77ad0aDb1bB93",
|
|
8
|
-
"lens": "0x680e15080Df9ff61131499D21aa5Ca9Bd05E60e0",
|
|
9
|
-
"fairLaunch": "0x4e91CdfeA23f44D4269E66494fe532867a0fAe5E",
|
|
10
|
-
"oracle": "0xe0E2Bb669a75Ae2384371cB4c4c95ff6fC1581b0",
|
|
11
|
-
"interestRateModel": "0x7346c735bce0c4838A917AFa9879F7723f1bB963",
|
|
12
|
-
"auTokens": {
|
|
13
|
-
"USDC": "0x1c7EB2ADdC2df2F28E9631cce970D2E2DF22429A",
|
|
14
|
-
"ETH": "0xdaE860b77c26498e7Bd8e16Fb80AD572FaB9688f",
|
|
15
|
-
"WBTC": "0x5329f32A9dDaC3d274Cc670B284561b0086D2244",
|
|
16
|
-
"USDT": "0x57E15Bf9Bc4c8a7AFd3C8DBE153ED29eC90B68Fa",
|
|
17
|
-
"DAI": "0xdCdA4c7eF408961200193d7180357AEC404C267A",
|
|
18
|
-
"PLY": "0xa8474c18f502551937367120a6D8453dA785f1DD",
|
|
19
|
-
"WNEAR": "0x2Db190F0Db94E78B87D805e022D2a07803652211"
|
|
20
|
-
},
|
|
21
|
-
"supportedTokens": {
|
|
22
|
-
"USDC": "0x3dcB6AdF46E4d854E94719b6ed9cfab6939cC1Cb",
|
|
23
|
-
"WBTC": "0x6fF98E346Ba4C56fBc3Ebc3f92477ffCe09D96AB",
|
|
24
|
-
"USDT": "0x05b8777B6c280DB4E61CF0F63d59b4Ac8ec70538",
|
|
25
|
-
"DAI": "0xd94951E6B276fD4327FFBD3253b6307d112403e2",
|
|
26
|
-
"PLY": "0x84B5C41DC786316c5aA319B5A22CA77472e1d31f",
|
|
27
|
-
"WNEAR": "0xb2cBCe33a6fb7D2efFb1cF73A654a4c0c9255874"
|
|
28
|
-
},
|
|
29
|
-
"PLY_AUR_LP": "",
|
|
30
|
-
"faucet": "0x8F791d611D71699B76C03857A51D7B7E5E66f01E"
|
|
31
|
-
}
|
package/src/dummy.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Token } from './token';
|
|
2
|
-
import { TokenAmount } from './tokenAmount';
|
|
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
|
-
};
|
package/src/helpers.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
|
-
import BigNumber from 'bignumber.js';
|
|
3
|
-
import { BigNumber as BN, utils } from 'ethers';
|
|
4
|
-
import { getQuery as getAuroraAPIQuery } from './aurora-api-helpers';
|
|
5
|
-
import { decimalRecords } from './decimals';
|
|
6
|
-
import { Address } from './types';
|
|
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
|
-
|
|
15
|
-
export function formatObject(object: Object) {
|
|
16
|
-
return JSON.stringify(object, null, ' ');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function decimalFactor(decimal: number) {
|
|
20
|
-
return BN.from(10).pow(decimal).toString();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const isSameAddress = (
|
|
24
|
-
address1: Address,
|
|
25
|
-
address2: Address
|
|
26
|
-
): boolean => {
|
|
27
|
-
return address1.toLowerCase() == address2.toLowerCase();
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const getCurrentTimestamp = (): number => {
|
|
31
|
-
return Math.trunc(Date.now() / 1000);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export function validateAndParseAddress(address: Address): Address {
|
|
35
|
-
try {
|
|
36
|
-
return utils.getAddress(address);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
throw new Error('Invalid address: ' + address);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function getDecimal(address: Address): number {
|
|
43
|
-
let addressLowercase = address.toLowerCase();
|
|
44
|
-
assert(
|
|
45
|
-
decimalRecords[addressLowercase] != undefined,
|
|
46
|
-
'Decimal not found for ' + address
|
|
47
|
-
);
|
|
48
|
-
return decimalRecords[addressLowercase];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function calcLMRewardApr(
|
|
52
|
-
rewardsValue: BigNumber,
|
|
53
|
-
totalStakeValue: BigNumber,
|
|
54
|
-
frequencyPerYear: number
|
|
55
|
-
): BigNumber {
|
|
56
|
-
if (totalStakeValue.lte(0)) {
|
|
57
|
-
// avoid division by zero when there is no stake
|
|
58
|
-
return new BigNumber('999999999');
|
|
59
|
-
}
|
|
60
|
-
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export async function getBlockTimestamp(
|
|
64
|
-
provider: Provider,
|
|
65
|
-
blockNumber: number
|
|
66
|
-
): Promise<number> {
|
|
67
|
-
const block = await provider.getBlock(blockNumber);
|
|
68
|
-
return block.timestamp;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get the block number of the last block that has a timestamp before the given timestamp
|
|
73
|
-
* @param timestamp input timestamp
|
|
74
|
-
* @returns return the last block that its timestamp <= the give timestamp
|
|
75
|
-
* @note Check this API for more information: https://aurorascan.dev/apis#blocks
|
|
76
|
-
*
|
|
77
|
-
* This function is much faster than using binary search.
|
|
78
|
-
*/
|
|
79
|
-
export async function getBlockBeforeTimestamp(
|
|
80
|
-
provider: Provider,
|
|
81
|
-
timestamp: number
|
|
82
|
-
) {
|
|
83
|
-
let result = await getAuroraAPIQuery('block', 'getblocknobytime', {
|
|
84
|
-
timestamp: timestamp,
|
|
85
|
-
closest: 'before',
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// In case the API return `Block timestamp too far in the future`
|
|
89
|
-
// use the last block number
|
|
90
|
-
return parseInt(result) || (await provider.getBlockNumber());
|
|
91
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { ethers } from 'ethers';
|
|
3
|
-
import { Logger } from 'ethers/lib/utils';
|
|
4
|
-
|
|
5
|
-
ethers.utils.Logger.setLogLevel(Logger.levels.ERROR);
|
|
6
|
-
BigNumber.config({ DECIMAL_PLACES: 50 });
|
|
7
|
-
|
|
8
|
-
export * from './SDK';
|
|
9
|
-
export * from './MoneyMarket';
|
|
10
|
-
export * from './BlockchainEntity';
|
|
11
|
-
export * from './helpers';
|
|
12
|
-
export * from './constants';
|
|
13
|
-
export * from './dummy';
|
|
14
|
-
export * from './priceFetcher';
|
|
15
|
-
export * from './token';
|
|
16
|
-
export * from './tokenAmount';
|
|
17
|
-
export * from './types';
|
|
18
|
-
export * from './airdrop-lottery';
|
|
19
|
-
export * from './transfer-event-query';
|
|
20
|
-
export * from './Papermill';
|