From 243e5acc530967f47b16e399427bc474f6036d90 Mon Sep 17 00:00:00 2001 From: zygomeb <87449555+zygomeb@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:46:56 +0100 Subject: [PATCH] Create optim.ts --- src/tokens/optim.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/tokens/optim.ts diff --git a/src/tokens/optim.ts b/src/tokens/optim.ts new file mode 100644 index 00000000..14b2d338 --- /dev/null +++ b/src/tokens/optim.ts @@ -0,0 +1,19 @@ +import { defaultFetcherOptions, SupplyFetcher } from "../types"; +import { getAmountInAddresses, getBlockFrostInstance } from "../utils"; + +const OPTIM = "e52964af4fffdb54504859875b1827b60ba679074996156461143dc1"; + +const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => { + const blockFrost = getBlockFrostInstance(options); + const total = 1e8; + const treasuryRaw = await getAmountInAddresses(blockFrost, OPTIM, [ + "stake178j4fcxw7pwgxw92yu28c2zqmjxnumumj52hxr9jtr6qwngf2ve5n", // OPTIM MULTISIG + ]); + const treasury = Number(treasuryRaw) / 1e6; + return { + circulating: (total - treasury).toString(), + total: total.toString(), + }; +}; + +export default fetcher;