@aurigami/sdk 1.9.0 → 1.9.2
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.cjs.development.js +25 -23
- 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 +25 -23
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/helpers.ts +1 -1
- package/src/helpers/priceFetcher.ts +5 -1
- package/src/interactors/misc.ts +5 -13
package/package.json
CHANGED
package/src/helpers/helpers.ts
CHANGED
|
@@ -157,6 +157,6 @@ export async function getBlockBeforeTimestamp(provider: Provider, timestamp: num
|
|
|
157
157
|
|
|
158
158
|
export function devLog(message?: any, ...optionalParams: any[]): void {
|
|
159
159
|
if ('production' !== process.env.NODE_ENV) {
|
|
160
|
-
console.log(message, ...optionalParams);
|
|
160
|
+
console.log('[DEV LOG]', message, ...optionalParams);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
@@ -102,10 +102,14 @@ export async function fetchLPPrice(
|
|
|
102
102
|
|
|
103
103
|
try {
|
|
104
104
|
// MUST await here
|
|
105
|
-
|
|
105
|
+
const lpPrice = await fetchLPPriceBy({
|
|
106
106
|
address: LPInfo.token0,
|
|
107
107
|
reserve: LPInfo.reserve0,
|
|
108
108
|
});
|
|
109
|
+
if (lpPrice.isZero()) {
|
|
110
|
+
throw Error(`Price is zero`);
|
|
111
|
+
}
|
|
112
|
+
return lpPrice;
|
|
109
113
|
} catch (e) {
|
|
110
114
|
devLog(`fetchLPPriceBy ${LPInfo.token0} failed`, e);
|
|
111
115
|
try {
|
package/src/interactors/misc.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BigNumber as BN } from 'ethers';
|
|
|
4
4
|
import * as abis from '../abis';
|
|
5
5
|
import * as consts from '../consts';
|
|
6
6
|
import { AuriEnv, BlockchainEntityRead, PLYToken, Token, TokenAmount } from '../entities';
|
|
7
|
-
import { decimalFactor, getSymbol, isSameAddress } from '../helpers/helpers';
|
|
7
|
+
import { decimalFactor, getDecimal, getSymbol, isSameAddress } from '../helpers/helpers';
|
|
8
8
|
import { calcValuation, fetchPrice } from '../helpers/priceFetcher';
|
|
9
9
|
import * as types from '../types';
|
|
10
10
|
import { MoneyMarketRead } from './MoneyMarket';
|
|
@@ -244,12 +244,6 @@ export class MiscRead extends BlockchainEntityRead {
|
|
|
244
244
|
};
|
|
245
245
|
|
|
246
246
|
const callResults = (await multicallRead.aggregate([
|
|
247
|
-
// Get total supply
|
|
248
|
-
{
|
|
249
|
-
...baseBalanceOfCall,
|
|
250
|
-
method: 'totalSupply',
|
|
251
|
-
args: [],
|
|
252
|
-
},
|
|
253
247
|
// balance in team multisig
|
|
254
248
|
{
|
|
255
249
|
...baseBalanceOfCall,
|
|
@@ -271,13 +265,11 @@ export class MiscRead extends BlockchainEntityRead {
|
|
|
271
265
|
args: [consts.networkAddresses.misc.PLY_TOKEN_LOCK],
|
|
272
266
|
},
|
|
273
267
|
])) as BN[][];
|
|
274
|
-
let circulatingSupply: BN = BN.from(
|
|
268
|
+
let circulatingSupply: BN = BN.from(
|
|
269
|
+
'1' + '0'.repeat(10) + '0'.repeat(getDecimal(this.env.ply.address))
|
|
270
|
+
);
|
|
275
271
|
callResults.forEach((result, i) => {
|
|
276
|
-
|
|
277
|
-
circulatingSupply = result[0];
|
|
278
|
-
} else {
|
|
279
|
-
circulatingSupply = circulatingSupply.sub(result[0]);
|
|
280
|
-
}
|
|
272
|
+
circulatingSupply = circulatingSupply.sub(result[0]);
|
|
281
273
|
});
|
|
282
274
|
|
|
283
275
|
return new TokenAmount(PLYToken, circulatingSupply.toString());
|