impermax-sdk 1.2.16 → 1.2.18
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/lib/config/contracts/lending-vault-watcher.js +1 -1
- package/lib/offchain/account/offchainAccount.js +2 -0
- package/lib/offchain/offchain.js +4 -0
- package/lib/offchain/offchainPoolToken.js +2 -0
- package/lib/onchain/account/onchainAccount.js +2 -0
- package/lib/onchain/impermaxFactory/onchainImpermaxFactory.js +1 -0
- package/lib/onchain/interactions/onchainInteractions.js +2 -0
- package/lib/onchain/onchain.js +3 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ exports.LENDING_VAULT_WATCHER = {
|
|
|
6
6
|
[types_1.Networks.Ropsten]: '',
|
|
7
7
|
[types_1.Networks.Mainnet]: '',
|
|
8
8
|
[types_1.Networks.Polygon]: '',
|
|
9
|
-
[types_1.Networks.Arbitrum]: '
|
|
9
|
+
[types_1.Networks.Arbitrum]: '0x0C6BE493CEFbFc135249156762d9977803B67B42',
|
|
10
10
|
[types_1.Networks.Avalanche]: '',
|
|
11
11
|
[types_1.Networks.Moonriver]: '',
|
|
12
12
|
[types_1.Networks.Aurora]: '',
|
|
@@ -31,6 +31,7 @@ class OffchainAccount {
|
|
|
31
31
|
}
|
|
32
32
|
getLendingPool(factory, pair) {
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
pair = pair.toLowerCase();
|
|
34
35
|
if (!this.lendingPools[factory])
|
|
35
36
|
this.lendingPools[factory] = {};
|
|
36
37
|
const lendingPoolsOfFactory = this.lendingPools[factory];
|
|
@@ -47,6 +48,7 @@ class OffchainAccount {
|
|
|
47
48
|
}
|
|
48
49
|
getLendingVault(vaultAddress) {
|
|
49
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
vaultAddress = vaultAddress.toLowerCase();
|
|
50
52
|
if (!this.lendingVaults[vaultAddress])
|
|
51
53
|
this.lendingVaults[vaultAddress] = this.initializeLendingVault(vaultAddress);
|
|
52
54
|
return this.lendingVaults[vaultAddress];
|
package/lib/offchain/offchain.js
CHANGED
|
@@ -109,12 +109,14 @@ class Offchain {
|
|
|
109
109
|
}
|
|
110
110
|
getLendingPool(factory, pairAddress) {
|
|
111
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
pairAddress = pairAddress.toLowerCase();
|
|
112
113
|
yield this.getLendingPoolsData(); // make sure that lending pools are initialized
|
|
113
114
|
return this.lendingPools[factory][pairAddress];
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
getLendingVault(vaultAddress) {
|
|
117
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
vaultAddress = vaultAddress.toLowerCase();
|
|
118
120
|
yield this.getLendingVaultsData(); // make sure that lending vaults are initialized
|
|
119
121
|
if (!this.lendingVaults)
|
|
120
122
|
this.lendingVaults = {};
|
|
@@ -124,6 +126,7 @@ class Offchain {
|
|
|
124
126
|
});
|
|
125
127
|
}
|
|
126
128
|
getAccount(accountAddress) {
|
|
129
|
+
accountAddress = accountAddress.toLowerCase();
|
|
127
130
|
if (!this.accounts[accountAddress])
|
|
128
131
|
this.accounts[accountAddress] = new account_1.default(this, accountAddress);
|
|
129
132
|
return this.accounts[accountAddress];
|
|
@@ -147,6 +150,7 @@ class Offchain {
|
|
|
147
150
|
}
|
|
148
151
|
getPairData(factory, pairAddress) {
|
|
149
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
pairAddress = pairAddress.toLowerCase();
|
|
150
154
|
const lendingPool = yield this.getLendingPool(factory, pairAddress);
|
|
151
155
|
const totalBorrowsUSD = yield lendingPool.getTotalBorrowsUSD();
|
|
152
156
|
return { pairAddress, factory, totalBorrowsUSD };
|
|
@@ -66,6 +66,8 @@ class OffchainPoolToken {
|
|
|
66
66
|
return "JPYCv1";
|
|
67
67
|
if (underlying.toLowerCase() === "0x431d5dff03120afa4bdf332c61a6e1766ef37bdb")
|
|
68
68
|
return "JPYCv2";
|
|
69
|
+
if (underlying.toLowerCase() === "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8")
|
|
70
|
+
return "USDC.e";
|
|
69
71
|
return this.getUnderlyingParam("symbol");
|
|
70
72
|
});
|
|
71
73
|
}
|
|
@@ -46,6 +46,7 @@ class OnchainAccount {
|
|
|
46
46
|
return new lendingPool_1.default(this, lendingPool);
|
|
47
47
|
}
|
|
48
48
|
getLendingPool(factory, pair) {
|
|
49
|
+
pair = pair.toLowerCase();
|
|
49
50
|
if (!this.lendingPools[factory])
|
|
50
51
|
this.lendingPools[factory] = {};
|
|
51
52
|
const accountLendingPools = this.lendingPools[factory];
|
|
@@ -58,6 +59,7 @@ class OnchainAccount {
|
|
|
58
59
|
return new onchainAccountLendingVault_1.default(this, lendingPool);
|
|
59
60
|
}
|
|
60
61
|
getLendingVault(vaultAddress) {
|
|
62
|
+
vaultAddress = vaultAddress.toLowerCase();
|
|
61
63
|
if (!this.lendingVaults[vaultAddress])
|
|
62
64
|
this.lendingVaults[vaultAddress] = this.initializeLendingVault(vaultAddress);
|
|
63
65
|
return this.lendingVaults[vaultAddress];
|
|
@@ -44,6 +44,7 @@ class OnchainImpermaxFactory {
|
|
|
44
44
|
return this.cache.routerContract;
|
|
45
45
|
}
|
|
46
46
|
getLendingPool(uniswapV2PairAddress) {
|
|
47
|
+
uniswapV2PairAddress = uniswapV2PairAddress.toLowerCase();
|
|
47
48
|
if (!this.lendingPools[uniswapV2PairAddress])
|
|
48
49
|
this.lendingPools[uniswapV2PairAddress] = new lendingPool_1.default(this, uniswapV2PairAddress);
|
|
49
50
|
return this.lendingPools[uniswapV2PairAddress];
|
|
@@ -43,6 +43,7 @@ class OnchainInteractions {
|
|
|
43
43
|
return new lendingPool_1.default(this, lendingPool);
|
|
44
44
|
}
|
|
45
45
|
getLendingPool(factory, pair) {
|
|
46
|
+
pair = pair.toLowerCase();
|
|
46
47
|
if (!this.lendingPools[factory])
|
|
47
48
|
this.lendingPools[factory] = {};
|
|
48
49
|
const interactionsLendingPools = this.lendingPools[factory];
|
|
@@ -51,6 +52,7 @@ class OnchainInteractions {
|
|
|
51
52
|
return interactionsLendingPools[pair];
|
|
52
53
|
}
|
|
53
54
|
initializeLendingVault(vaultAddress) {
|
|
55
|
+
vaultAddress = vaultAddress.toLowerCase();
|
|
54
56
|
const lendingVault = this.onchain.getLendingVault(vaultAddress);
|
|
55
57
|
return new onchainInteractionsLendingVault_1.default(this, lendingVault);
|
|
56
58
|
}
|
package/lib/onchain/onchain.js
CHANGED
|
@@ -52,16 +52,19 @@ class Onchain {
|
|
|
52
52
|
return this.factories[factory];
|
|
53
53
|
}
|
|
54
54
|
getLendingVault(vaultAddress) {
|
|
55
|
+
vaultAddress = vaultAddress.toLowerCase();
|
|
55
56
|
if (!this.lendingVaults[vaultAddress])
|
|
56
57
|
this.lendingVaults[vaultAddress] = new onchainLendingVault_1.default(this, vaultAddress);
|
|
57
58
|
return this.lendingVaults[vaultAddress];
|
|
58
59
|
}
|
|
59
60
|
getAccount(address) {
|
|
61
|
+
address = address.toLowerCase();
|
|
60
62
|
if (!this.accounts[address])
|
|
61
63
|
this.accounts[address] = new account_1.default(this, address);
|
|
62
64
|
return this.accounts[address];
|
|
63
65
|
}
|
|
64
66
|
getInteractions(address) {
|
|
67
|
+
address = address.toLowerCase();
|
|
65
68
|
if (!this.interactions[address])
|
|
66
69
|
this.interactions[address] = new interactions_1.default(this, address);
|
|
67
70
|
return this.interactions[address];
|