Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
add CHIPS market-cap (#394)
Browse files Browse the repository at this point in the history
* add CHIPS market-cap

Signed-off-by: James Ng <[email protected]>

* update mnt

Signed-off-by: James Ng <[email protected]>

---------

Signed-off-by: James Ng <[email protected]>
  • Loading branch information
0xj4m35 authored Dec 10, 2024
1 parent 099a701 commit 48f2977
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import cerraFetcher from "./tokens/cerra";
import cgiFetcher from "./tokens/cgi";
import charlyFetcher from "./tokens/charly";
import chipFetcher from "./tokens/chip";
import chipsFetcher from "./tokens/chips";
import clapFetcher from "./tokens/clap";
import clarityFetcher from "./tokens/clarity";
import clayFetcher from "./tokens/clay";
Expand Down Expand Up @@ -360,4 +361,5 @@ export const supplyFetchers: Record<string, SupplyFetcher> = {
"30d2ebdb2fec06142ee84e5120c2717b4d68a91bffd924420d94ddea43484950": chipFetcher,
"86340a33acf14b5c967584c9a20e984695ab3289696d138048f572be4255524e5a": burnzFetcher,
"766fce8055f39d40fcfc19721677b3deb2e7846950ae08dce757f1e753554741522042555348": sugarBushFetcher,
"5df9a1b9af5172602cbf8e4ba9c2a608c3820fc6e5d8c5e48f2d907c5468652047697261666665": chipsFetcher,
};
26 changes: 26 additions & 0 deletions src/tokens/chips.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defaultFetcherOptions, SupplyFetcher } from "../types";
import { getAmountInAddresses, getBlockFrostInstance } from "../utils";

const CHIPS = "5df9a1b9af5172602cbf8e4ba9c2a608c3820fc6e5d8c5e48f2d907c5468652047697261666665";

const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => {
const blockFrost = getBlockFrostInstance(options);
const total = 1_000_000_000;
const treasuryRaw = await getAmountInAddresses(blockFrost, CHIPS, [
"stake1uxtyqt2qck9mcxek68vqmyyly95a9h7n7qk40gxezp3uxvs9cmtjr", // Treasury
]);

const burnRaw = await getAmountInAddresses(blockFrost, CHIPS, [
"addr1w8qmxkacjdffxah0l3qg8hq2pmvs58q8lcy42zy9kda2ylc6dy5r4", // burn address
]);

const treasury = Number(treasuryRaw);
const burn = Number(burnRaw);

return {
circulating: (total - burn - treasury).toString(),
total: (total - burn).toString(),
};
};

export default fetcher;
19 changes: 8 additions & 11 deletions src/tokens/mnt.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { defaultFetcherOptions, SupplyFetcher } from "../types";
import { getAxiosInstance } from "../utils";

// eslint-disable-next-line unused-imports/no-unused-vars
const MNT = "43b07d4037f0d75ee10f9863097463fc02ff3c0b8b705ae61d9c75bf";

const TOTAL_SUPPLY = 100_000_000;

const MNT_SUPPLY_ADDRESS = "https://www.mynth.ai/api/token-supply";

const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => {
const axios = getAxiosInstance(options);
const response = await axios.get(MNT_SUPPLY_ADDRESS);
const treasury = response.data.current_supply;
const [totalSupplyResponse, circulatingResponse] = await Promise.all([
axios.get("https://www.mynth.ai/api/total-supply"),
axios.get("https://www.mynth.ai/api/current-supply"),
]);
const totalSupply = Number(totalSupplyResponse.data) / 1e6;
const circulating = Number(circulatingResponse.data) / 1e6;

return {
circulating: treasury.toString(),
total: TOTAL_SUPPLY.toString(),
total: totalSupply.toString(),
circulating: circulating.toString(),
};
};

Expand Down

0 comments on commit 48f2977

Please sign in to comment.