From 0659292d9a57e4c97a537f38e6404dbd2dbc8821 Mon Sep 17 00:00:00 2001 From: MuesliSwapTeam Date: Fri, 4 Aug 2023 00:16:38 +0200 Subject: [PATCH 1/2] Add LIFI token --- src/index.ts | 2 ++ src/tokens/lifi.ts | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/tokens/lifi.ts diff --git a/src/index.ts b/src/index.ts index e74fa84b..6714c2ff 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,6 +32,7 @@ import indyFetcher from "./tokens/indy"; import iusdFetcher from "./tokens/iusd"; import lobsterFetcher from "./tokens/lobster"; import liqwidFetcher from "./tokens/lq"; +import lifiFetcher from "./tokens/lifi"; import meldFetcher from "./tokens/meld"; import milkFetcher from "./tokens/milk"; import minFetcher from "./tokens/min"; @@ -163,4 +164,5 @@ export const supplyFetchers: Record = { "43b07d4037f0d75ee10f9863097463fc02ff3c0b8b705ae61d9c75bf4d796e746820546f6b656e": mntFetcher, "1ddcb9c9de95361565392c5bdff64767492d61a96166cb16094e54be4f5054": optFetcher, + "7914fae20eb2903ed6fd5021a415c1bd2626b64a2d86a304cb40ff5e4c494649": lifiFetcher, }; diff --git a/src/tokens/lifi.ts b/src/tokens/lifi.ts new file mode 100644 index 00000000..a14891cc --- /dev/null +++ b/src/tokens/lifi.ts @@ -0,0 +1,23 @@ +import { defaultFetcherOptions, SupplyFetcher } from "../types"; +import { getAmountInAddresses, getBlockFrostInstance } from "../utils"; + +const OPT = "7914fae20eb2903ed6fd5021a415c1bd2626b64a2d86a304cb40ff5e4c494649"; +const TREASURY_ADDRESSES = [ + "addr1q9gt5vycpjqmqddvjrl6tf4ctn2tlvpsls5qa7h862vvqxgve9jeadjstl54dnds5ye4f8jnkm404ryhz527cucfgwlqnrargr", + "addr1q8n6xylsyg3fuye3xvxlpxvumdkutpvc07p6z6js6g85hn5gdxvcfq8mr6rzq7gkegy0xkt9kp6u8vxxrcvd4058p7aq7zn9jd", + "addr1q9t9dlhshmcdqsuu799mktwpxmw35w3rffj63xzphyquksyk2q0gxhpk3tlvuer9jyryxe73xzgc76n58vyg3d8kgcdqex46uk", +]; + +const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => { + const blockFrost = getBlockFrostInstance(options); + const total = 40e6; // 40 million + const treasury = + Number(await getAmountInAddresses(blockFrost, OPT, TREASURY_ADDRESSES)) / + 1e6; + return { + circulating: (total - treasury).toString(), + total: total.toString(), + }; +}; + +export default fetcher; From c88ade2505af68837741479aec151559756d82ee Mon Sep 17 00:00:00 2001 From: MuesliSwapTeam Date: Fri, 4 Aug 2023 21:18:38 +0200 Subject: [PATCH 2/2] Fix formatting --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 6714c2ff..555570e5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,9 +30,9 @@ import ibtcFetcher from "./tokens/ibtc"; import iethFetcher from "./tokens/ieth"; import indyFetcher from "./tokens/indy"; import iusdFetcher from "./tokens/iusd"; +import lifiFetcher from "./tokens/lifi"; import lobsterFetcher from "./tokens/lobster"; import liqwidFetcher from "./tokens/lq"; -import lifiFetcher from "./tokens/lifi"; import meldFetcher from "./tokens/meld"; import milkFetcher from "./tokens/milk"; import minFetcher from "./tokens/min"; @@ -164,5 +164,6 @@ export const supplyFetchers: Record = { "43b07d4037f0d75ee10f9863097463fc02ff3c0b8b705ae61d9c75bf4d796e746820546f6b656e": mntFetcher, "1ddcb9c9de95361565392c5bdff64767492d61a96166cb16094e54be4f5054": optFetcher, - "7914fae20eb2903ed6fd5021a415c1bd2626b64a2d86a304cb40ff5e4c494649": lifiFetcher, + "7914fae20eb2903ed6fd5021a415c1bd2626b64a2d86a304cb40ff5e4c494649": + lifiFetcher, };