@aurigami/sdk 0.6.4 → 0.6.6
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 -0
- package/dist/sdk.cjs.development.js +84 -46
- 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 +84 -46
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/MoneyMarket.ts +5 -1
- package/src/SDK.ts +3 -2
- package/src/constants.ts +29 -21
- package/src/decimals.ts +13 -14
- package/src/deployments/aurora_mainnet.json +21 -0
- package/src/deployments/aurora_testnet.json +27 -28
- package/src/priceFetcher.ts +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.6.
|
|
2
|
+
"version": "0.6.6",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"typescript": "^4.5.4"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@aurigami/contracts": "
|
|
60
|
+
"@aurigami/contracts": "2.3.0-beta",
|
|
61
61
|
"axios": "^0.24.0",
|
|
62
62
|
"bignumber.js": "^9.0.2",
|
|
63
63
|
"dotenv": "^16.0.0",
|
package/src/MoneyMarket.ts
CHANGED
|
@@ -210,7 +210,11 @@ export class MoneyMarketReadWrite extends MoneyMarketRead {
|
|
|
210
210
|
public async repay(amount: TokenAmount): Promise<TransactionResponse> {
|
|
211
211
|
var repayAmount: BN;
|
|
212
212
|
if (new BigNumber(amount.rawAmount()).lt(0)) {
|
|
213
|
-
|
|
213
|
+
if (isSameAddress(amount.token.address, ETHAddress)) {
|
|
214
|
+
repayAmount = BN.from((await this.getUserBorrowBalance(await this._networkConnection.signer!.getAddress())).rawAmount());
|
|
215
|
+
} else {
|
|
216
|
+
repayAmount = INF;
|
|
217
|
+
}
|
|
214
218
|
} else {
|
|
215
219
|
repayAmount = BN.from(amount.rawAmount());
|
|
216
220
|
}
|
package/src/SDK.ts
CHANGED
|
@@ -128,7 +128,8 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
128
128
|
for (var i = 0; i < marketCount; i ++) {
|
|
129
129
|
const auToken = networkAddresses.auTokens[i];
|
|
130
130
|
const moneyMarket: MoneyMarketRead = new MoneyMarketRead(this._networkConnection, auToken.address, auToken.underlying);
|
|
131
|
-
const
|
|
131
|
+
const borrowLimitMargin = totalBorrowLimit.minus(minimumBorrowLimitAllowed).gt(0) ? totalBorrowLimit.minus(minimumBorrowLimitAllowed) : new BigNumber(0);
|
|
132
|
+
const maxWithdrawCap: BigNumber = borrowLimitMargin.div(userMarketDetails[i].collateralRatio).div(underlyingPrices[i]);
|
|
132
133
|
userMarketDetails[i].maxWithdrawableAmount = userMarketDetails[i].isCollateral && maxWithdrawCap.lt(userMarketDetails[i].depositBalance.formattedAmount())
|
|
133
134
|
? new TokenAmount(
|
|
134
135
|
moneyMarket.underlying,
|
|
@@ -254,7 +255,7 @@ export class SdkReadWrite extends SdkRead {
|
|
|
254
255
|
);
|
|
255
256
|
}
|
|
256
257
|
public async stake(amount: TokenAmount): Promise<TransactionResponse> {
|
|
257
|
-
return this._auriFairLaunch.connect(this._networkConnection.signer!).deposit(AurPlyPid, amount.rawAmount()
|
|
258
|
+
return this._auriFairLaunch.connect(this._networkConnection.signer!).deposit(AurPlyPid, amount.rawAmount());
|
|
258
259
|
}
|
|
259
260
|
public async unstake(amount: TokenAmount): Promise<TransactionResponse> {
|
|
260
261
|
return this._auriFairLaunch.connect(this._networkConnection.signer!).withdraw(AurPlyPid, amount.rawAmount());
|
package/src/constants.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const DECIMAL_PRECISION = 10;
|
|
|
9
9
|
|
|
10
10
|
export type NetworkAddresses = {
|
|
11
11
|
auTokens: {
|
|
12
|
+
name: string,
|
|
12
13
|
address: string,
|
|
13
14
|
underlying: string
|
|
14
15
|
}[],
|
|
@@ -18,45 +19,52 @@ export type NetworkAddresses = {
|
|
|
18
19
|
export const networkAddresses: NetworkAddresses = {
|
|
19
20
|
auTokens: [
|
|
20
21
|
{
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
name: "auUSDC",
|
|
23
|
+
address: '0x7A9984522bC81B348d66379ed36Be5BD6147820E'.toLowerCase(),
|
|
24
|
+
underlying: '0xe1Db3E2f129539b2399d8Cd9e808305c85f0c82f'.toLowerCase()
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
|
-
|
|
27
|
+
name: "auETH",
|
|
28
|
+
address: '0x0e2E6069231928429F36dCA288466bC738e602b3'.toLowerCase(),
|
|
26
29
|
underlying: ETHAddress.toLowerCase()
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
name: "auWBTC",
|
|
33
|
+
address: '0x981bD5832EAB9C8F607940E0e9faCBf8C09ee20a'.toLowerCase(),
|
|
34
|
+
underlying: '0xA69506eAbdC11BBdAf2259882A02a91B66E6d7E1'.toLowerCase()
|
|
31
35
|
},
|
|
32
36
|
{
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
name: "auUSDT",
|
|
38
|
+
address: '0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
|
|
39
|
+
underlying: '0x4459ED2dEFFe0569AE748aD5D7cFEFDeeF667E87'.toLowerCase()
|
|
35
40
|
},
|
|
36
41
|
{
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
name: "auDAI",
|
|
43
|
+
address: '0xC337343d1ac9F77B1305261CCD17e3799F088D4B'.toLowerCase(),
|
|
44
|
+
underlying: '0x1c9998C7768517b83136d3b237a31bc69eDc9028'.toLowerCase()
|
|
39
45
|
},
|
|
40
46
|
{
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
name: "auPLY",
|
|
48
|
+
address: '0x5e063B255e2437D75180117905499139a93f16E6'.toLowerCase(),
|
|
49
|
+
underlying: '0x3cD388c98FE71fE1a37272279F4b50bF27037E23'.toLowerCase()
|
|
43
50
|
},
|
|
44
51
|
{
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
name: "auWNEAR",
|
|
53
|
+
address: '0x910fb0AE51761ccCDBbD9ced613e6A4dc571594a'.toLowerCase(),
|
|
54
|
+
underlying: '0x01B2EDff9b095DC270beca46E2eFB41a3ecEE169'.toLowerCase()
|
|
47
55
|
}
|
|
48
56
|
],
|
|
49
57
|
misc: {
|
|
50
|
-
COMPTROLLER: "
|
|
51
|
-
oracle: "
|
|
52
|
-
AURIFAIRLAUNCH: "
|
|
53
|
-
AURILENS: '
|
|
54
|
-
TOKENLOCK: '
|
|
55
|
-
FAUCET:
|
|
58
|
+
COMPTROLLER: "0x79e62AAfc1675c9F737Ec4Bb949115bfC8D2E2E6".toLowerCase(),
|
|
59
|
+
oracle: "0xAc99efFDF7a8934e35Ad13880D25127c548A7e6d".toLowerCase(),
|
|
60
|
+
AURIFAIRLAUNCH: "0xD204fD43bFe4aAEB9aB993c116c1dECdDF1b9F1A".toLowerCase(),
|
|
61
|
+
AURILENS: '0x0Aa7Ce0f5D6259412602A230C3Ed83eDc857bDa1'.toLowerCase(),
|
|
62
|
+
TOKENLOCK: '0x1b5c4c6A77f784104662B293a0166B27aF71d2c0'.toLowerCase(),
|
|
63
|
+
FAUCET: "0xe8b53eE0443620fB8DcEaEB6DE98ED117971c329".toLowerCase() // doesn't exist on mainnet
|
|
56
64
|
},
|
|
57
65
|
tokens: {
|
|
58
|
-
AURORA:
|
|
59
|
-
PLY: "
|
|
66
|
+
AURORA: dummyAddress.toLowerCase(),
|
|
67
|
+
PLY: "0x3cD388c98FE71fE1a37272279F4b50bF27037E23".toLowerCase(),
|
|
60
68
|
AURPLY: dummyAddress.toLowerCase() // This is dummy
|
|
61
69
|
}
|
|
62
70
|
}
|
package/src/decimals.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export const decimalRecords: Record<string, number> = {
|
|
2
2
|
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
|
|
3
|
-
'
|
|
4
|
-
'
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'0x57e15bf9bc4c8a7afd3c8dbe153ed29ec90b68fa': 8
|
|
3
|
+
'0xdacc02a4ff16ea3c1515adbfdceb7b1f448b79c8': 8,
|
|
4
|
+
'0x01b2edff9b095dc270beca46e2efb41a3ecee169': 24,
|
|
5
|
+
'0x4459ed2deffe0569ae748ad5d7cfefdeef667e87': 6,
|
|
6
|
+
'0x3cd388c98fe71fe1a37272279f4b50bf27037e23': 18,
|
|
7
|
+
'0x1c9998c7768517b83136d3b237a31bc69edc9028': 18,
|
|
8
|
+
'0x7a9984522bc81b348d66379ed36be5bd6147820e': 8,
|
|
9
|
+
'0x0e2e6069231928429f36dca288466bc738e602b3': 8,
|
|
10
|
+
'0x981bd5832eab9c8f607940e0e9facbf8c09ee20a': 8,
|
|
11
|
+
'0xa69506eabdc11bbdaf2259882a02a91b66e6d7e1': 8,
|
|
12
|
+
'0x910fb0ae51761cccdbbd9ced613e6a4dc571594a': 8,
|
|
13
|
+
'0xe1db3e2f129539b2399d8cd9e808305c85f0c82f': 6,
|
|
14
|
+
'0x5e063b255e2437d75180117905499139a93f16e6': 8,
|
|
15
|
+
'0xc337343d1ac9f77b1305261ccd17e3799f088d4b': 8
|
|
17
16
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"deployer": "0xb969526EBc8dd4b1d816Da846eE08180515fFBbC",
|
|
3
|
+
"unitroller": "0xe3618BaDA3728a339A2214423C0426AD47d30626",
|
|
4
|
+
"comptrollerImpl": "0xEAdafBD9D7c09CE42512bf38d12abCD2D9ECBe0E",
|
|
5
|
+
"comptroller": "0xe3618BaDA3728a339A2214423C0426AD47d30626",
|
|
6
|
+
"PLY": "0x9ae13dd1FFd2008F68bC71d93C5a2381dC3F1D27",
|
|
7
|
+
"jumpRateModel": "0xA70d805Ed5B2DfF627Cf7046C131D73DFe11C59c",
|
|
8
|
+
"oracle": "0xC6e5185438e1730959c1eF3551059A3feC744E90",
|
|
9
|
+
"auTokens": {
|
|
10
|
+
"USDC": "0x9728d8920707a5C12958E4cB2979Ae5588F85EcA",
|
|
11
|
+
"ETH": "0xc263e92038139879918C0DE0e97eA2F3f3984F72",
|
|
12
|
+
"WBTC": "0xC08FF86edF64c2d3816Eb43c5Ec95475a2d47BD0",
|
|
13
|
+
"USDT": "0x22AE568df8D8AeE3Ed9Ab0f135Ca8cFeF5d2Cf18",
|
|
14
|
+
"DAI": "0x6664d272c820d70c923DE9b1992De02A12C8a7d8",
|
|
15
|
+
"PLY": "0xD204fD43bFe4aAEB9aB993c116c1dECdDF1b9F1A",
|
|
16
|
+
"WNEAR": "0xa64F1875080B91Db293dE1f547DC1D6Bc5d3Ef55"
|
|
17
|
+
},
|
|
18
|
+
"tokenLock": "0xE28339435478245CB1c57f84D246b67EECb3E204",
|
|
19
|
+
"fairLaunch": "0x451d4e8964d79081EFFDAEde236354b20b678640",
|
|
20
|
+
"auriLens": "0xe8b53eE0443620fB8DcEaEB6DE98ED117971c329"
|
|
21
|
+
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"comptroller": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"fairLaunch": "0x4e91CdfeA23f44D4269E66494fe532867a0fAe5E",
|
|
10
|
-
"oracle": "0xe0E2Bb669a75Ae2384371cB4c4c95ff6fC1581b0",
|
|
11
|
-
"interestRateModel": "0x7346c735bce0c4838A917AFa9879F7723f1bB963",
|
|
2
|
+
"deployer": "0xb969526EBc8dd4b1d816Da846eE08180515fFBbC",
|
|
3
|
+
"unitroller": "0x79e62AAfc1675c9F737Ec4Bb949115bfC8D2E2E6",
|
|
4
|
+
"comptrollerImpl": "0xBF44f4D1A5E9a1B324E9115CE5b58CDA07142Dbb",
|
|
5
|
+
"comptroller": "0x79e62AAfc1675c9F737Ec4Bb949115bfC8D2E2E6",
|
|
6
|
+
"PLY": "0x3cD388c98FE71fE1a37272279F4b50bF27037E23",
|
|
7
|
+
"jumpRateModel": "0x6664d272c820d70c923DE9b1992De02A12C8a7d8",
|
|
8
|
+
"oracle": "0xAc99efFDF7a8934e35Ad13880D25127c548A7e6d",
|
|
12
9
|
"auTokens": {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
"USDT": "0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8",
|
|
11
|
+
"WBTC": "0x981bD5832EAB9C8F607940E0e9faCBf8C09ee20a",
|
|
12
|
+
"ETH": "0x0e2E6069231928429F36dCA288466bC738e602b3",
|
|
13
|
+
"USDC": "0x7A9984522bC81B348d66379ed36Be5BD6147820E",
|
|
14
|
+
"DAI": "0xC337343d1ac9F77B1305261CCD17e3799F088D4B",
|
|
15
|
+
"PLY": "0x5e063B255e2437D75180117905499139a93f16E6",
|
|
16
|
+
"WNEAR": "0x910fb0AE51761ccCDBbD9ced613e6A4dc571594a"
|
|
20
17
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
"tokenLock": "0x1b5c4c6A77f784104662B293a0166B27aF71d2c0",
|
|
19
|
+
"fairLaunch": "0xD204fD43bFe4aAEB9aB993c116c1dECdDF1b9F1A",
|
|
20
|
+
"auriLens": "0x0Aa7Ce0f5D6259412602A230C3Ed83eDc857bDa1",
|
|
21
|
+
"test": {
|
|
22
|
+
"USDC": "0xe1Db3E2f129539b2399d8Cd9e808305c85f0c82f",
|
|
23
|
+
"USDT": "0x4459ED2dEFFe0569AE748aD5D7cFEFDeeF667E87",
|
|
24
|
+
"DAI": "0x1c9998C7768517b83136d3b237a31bc69eDc9028",
|
|
25
|
+
"WBTC": "0xA69506eAbdC11BBdAf2259882A02a91B66E6d7E1",
|
|
26
|
+
"WNEAR": "0x01B2EDff9b095DC270beca46E2eFB41a3ecEE169",
|
|
27
|
+
"PLY": "0x3cD388c98FE71fE1a37272279F4b50bF27037E23",
|
|
28
|
+
"faucet": "0xe8b53eE0443620fB8DcEaEB6DE98ED117971c329"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/priceFetcher.ts
CHANGED
|
@@ -101,7 +101,7 @@ export async function fetchPrice(address: Address, provider: providers.Provider)
|
|
|
101
101
|
});
|
|
102
102
|
if (matchingAuToken !== undefined) {
|
|
103
103
|
return fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider);
|
|
104
|
-
} else if (isSameAddress(address, networkAddresses.
|
|
104
|
+
} else if (isSameAddress(address, networkAddresses.tokens.AUPLYLP)) {
|
|
105
105
|
return fetchLPPrice(address, provider);
|
|
106
106
|
} else {
|
|
107
107
|
return fetchPriceFromCoingecko(address);
|