Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN yarn install --frozen-lockfile
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/src/config/global-bundle.pem ./dist/config/global-bundle.pem
COPY --from=builder /app/src/kadena-server/config/schema.graphql ./dist/kadena-server/config/schema.graphql
COPY --from=builder /app/src/circulating-coins/ ./dist/circulating-coins/
EXPOSE 3001

CMD ["node", "dist/index.js", "--graphql"]
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default class NetworkDbRepository implements NetworkRepository {

const { rows } = await rootPgPool.query(creationTimeQuery);

const latestCreationTime = parseInt(rows[0].creationTime, 10);
const firstRow = rows?.[0]?.creationTime;
const latestCreationTime = parseInt(firstRow, 10);

return latestCreationTime;
}
Expand Down
13 changes: 9 additions & 4 deletions indexer/src/kadena-server/utils/coin-circulation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Papa from "papaparse";
import fs from "fs";
import path from "path";

type RewardRow = [number, number];

Expand Down Expand Up @@ -92,17 +93,21 @@ async function getCsvContent(filePath: string): Promise<string> {
}

async function getMinerRewards(cutHeight: number) {
const csvContent = await getCsvContent(
`${__dirname}/../../../../csvs/miner_rewards.csv`,
const filePath = path.resolve(
__dirname,
"../../circulating-coins/miner_rewards.csv",
);
const csvContent = await getCsvContent(filePath);
const reward = calculateReward(csvContent, cutHeight);
return reward;
}

async function getTokenPayments(latestCreationTime: number) {
const csvContent = await getCsvContent(
`${__dirname}/../../../../csvs/token_payments.csv`,
const filePath = path.resolve(
__dirname,
"../../circulating-coins/token_payments.csv",
);
const csvContent = await getCsvContent(filePath);
const tokenPayments = calculateTokenPayments(csvContent, latestCreationTime);
return tokenPayments;
}
Expand Down