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

Commit

Permalink
Create sugarBush.ts (#387)
Browse files Browse the repository at this point in the history
* Create sugarBush.ts

* Update index.ts
  • Loading branch information
snekdotfun authored Nov 18, 2024
1 parent 7467227 commit 5da7b7c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ import squeakFetcher from "./tokens/squeak";
import ssssFetcher from "./tokens/ssss";
import stableFetcher from "./tokens/stable";
import strikeFetcher from "./tokens/strike";
import sugarBushFetcher from "./tokens/sugarBush";
import sundaeFetcher from "./tokens/sundae";
import tedyFetcher from "./tokens/tedy";
import tetFetcher from "./tokens/tet";
Expand Down Expand Up @@ -358,4 +359,5 @@ export const supplyFetchers: Record<string, SupplyFetcher> = {
"9d8c863907e6e58823c9af13759e196dbf5da172b7d4ce37d5d1147950494755": piguFetcher,
"30d2ebdb2fec06142ee84e5120c2717b4d68a91bffd924420d94ddea43484950": chipFetcher,
"86340a33acf14b5c967584c9a20e984695ab3289696d138048f572be4255524e5a": burnzFetcher,
"766fce8055f39d40fcfc19721677b3deb2e7846950ae08dce757f1e753554741522042555348": sugarBushFetcher,
};
22 changes: 22 additions & 0 deletions src/tokens/sugarBush.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defaultFetcherOptions, SupplyFetcher } from "../types";
import { getAmountInAddresses, getBlockFrostInstance } from "../utils";

// Total supply of any token launched on snek.fun
const SNEKFUN_TOTAL_SUPPLY_DEFAULT = 1e9;

// The base16-encoded policyId + base16-encoded assetName
const TOKEN_SUBJECT = "766fce8055f39d40fcfc19721677b3deb2e7846950ae08dce757f1e753554741522042555348";

// Not counted in the supply
const BURN_SNEK_ADDR = "addr1w8qmxkacjdffxah0l3qg8hq2pmvs58q8lcy42zy9kda2ylc6dy5r4";

const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => {
const blockFrost = getBlockFrostInstance(options);
const burnsnekAmount = Number(await getAmountInAddresses(blockFrost, TOKEN_SUBJECT, [BURN_SNEK_ADDR]));
return {
circulating: (SNEKFUN_TOTAL_SUPPLY_DEFAULT - burnsnekAmount).toString(),
total: SNEKFUN_TOTAL_SUPPLY_DEFAULT.toString(),
};
};

export default fetcher;

0 comments on commit 5da7b7c

Please sign in to comment.