carbon-js-sdk 0.6.4 → 0.6.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.
|
@@ -19,6 +19,7 @@ const bignumber_js_1 = require("bignumber.js");
|
|
|
19
19
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
20
20
|
const long_1 = __importDefault(require("long"));
|
|
21
21
|
const base_1 = __importDefault(require("./base"));
|
|
22
|
+
const number_1 = require("../util/number");
|
|
22
23
|
class LiquidityPoolModule extends base_1.default {
|
|
23
24
|
create(params, opts) {
|
|
24
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -164,14 +165,14 @@ class LiquidityPoolModule extends base_1.default {
|
|
|
164
165
|
getWeeklyRewardsRealInflation() {
|
|
165
166
|
var _a;
|
|
166
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
const mintDataResponse = yield this.sdkProvider.query.inflation.MintData({});
|
|
169
|
+
let weeklyRewards = number_1.BN_ZERO;
|
|
170
|
+
if (mintDataResponse.mintData) {
|
|
171
|
+
const mintData = mintDataResponse.mintData;
|
|
172
|
+
const currentSupply = new bignumber_js_1.BigNumber(mintData.currentSupply);
|
|
173
|
+
const swthInflationRate = new bignumber_js_1.BigNumber(mintData.inflationRate).shiftedBy(-18);
|
|
174
|
+
weeklyRewards = currentSupply.times(swthInflationRate).div(52);
|
|
173
175
|
}
|
|
174
|
-
const weeklyRewards = INITIAL_SUPPLY.div(52).times(inflationRate);
|
|
175
176
|
// Calculate weekly rewards earned by liquidity providers
|
|
176
177
|
// Weekly LP Rewards = liquidityRewardRatio * weeklyRewards
|
|
177
178
|
const distributionParams = yield this.sdkProvider.query.distribution.Params({});
|