Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions packages/core-api/src/versions/1/blocks/controller.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { supplyCalculator } from "@arkecosystem/core-utils";
import { bignumify } from "@arkecosystem/core-utils";
import Boom from "boom";
import Hapi from "hapi";
Expand Down Expand Up @@ -105,14 +106,8 @@ export class BlocksController extends Controller {

public async supply(request: Hapi.Request, h: Hapi.ResponseToolkit) {
try {
const lastBlock = this.blockchain.getLastBlock();
const constants = this.config.getMilestone(lastBlock.data.height);
const rewards = bignumify(constants.reward).times(lastBlock.data.height - constants.height);

return super.respondWith({
supply: +bignumify(this.config.get("genesisBlock.totalAmount"))
.plus(rewards)
.toFixed(),
supply: supplyCalculator.calculate(this.blockchain.getLastBlock().data.height),
});
} catch (error) {
return Boom.badImplementation(error);
Expand Down