From 44abb92bc56c4f4185365e0040d466a943d8053f Mon Sep 17 00:00:00 2001 From: NFTKri <166889251+NFTKri@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:26:58 -0400 Subject: [PATCH] Add Safe (#363) * Create safe.ts * Update index.ts * Update index.ts Attempting to pass test --- src/index.ts | 3 +++ src/tokens/safe.ts | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/tokens/safe.ts diff --git a/src/index.ts b/src/index.ts index 694f4c54..85ad94db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -125,6 +125,7 @@ import rjvFetcher from "./tokens/rjv"; import rsbtcFetcher from "./tokens/rsbtc"; import rsergFetcher from "./tokens/rserg"; import rsrsnFetcher from "./tokens/rsrsn"; +import safeFetcher from "./tokens/safe"; import scaleFetcher from "./tokens/scale"; import shardsFetcher from "./tokens/shards"; import sharkyFetcher from "./tokens/sharky"; @@ -453,4 +454,6 @@ export const supplyFetchers: Record = { slopFetcher, "7d869e0e6f936c3299a8b8df2b8f13d5233801e11676ff06e78e8dbe4649474854": fightFetcher, + "81926a57a567c11f6dc502254c5ed2d11fdba4ed9f898916699c6f1753414645": + safeFetcher, }; diff --git a/src/tokens/safe.ts b/src/tokens/safe.ts new file mode 100644 index 00000000..f39d1006 --- /dev/null +++ b/src/tokens/safe.ts @@ -0,0 +1,25 @@ +import { defaultFetcherOptions, SupplyFetcher } from "../types"; +import { getAmountInAddresses, getBlockFrostInstance } from "../utils"; + +const SAFE = "81926a57a567c11f6dc502254c5ed2d11fdba4ed9f898916699c6f1753414645"; + +const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => { + const blockFrost = getBlockFrostInstance(options); + const total = 420_698_008_135; + const treasuryRaw = await getAmountInAddresses(blockFrost, SAFE, [ + "stake1u9m784lg688hwhsfp72zmff522jcsp62m9txljtatujw5hgtk80fj", // Treasury + ]); + + const burnRaw = await getAmountInAddresses(blockFrost, SAFE, [ + "addr1w8qmxkacjdffxah0l3qg8hq2pmvs58q8lcy42zy9kda2ylc6dy5r4", // burn address + ]); + + const treasury = Number(treasuryRaw); + const burn = Number(burnRaw); + return { + circulating: (total - treasury - burn).toString(), + total: (total - burn).toString(), + }; +}; + +export default fetcher;