Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OPT token circulating supply #95

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import newmFetcher from "./tokens/newm";
import ninjazFetcher from "./tokens/ninjaz";
import nmkrFetcher from "./tokens/nmkr";
import ntxFetcher from "./tokens/ntx";
import optFetcher from "./tokens/opt";
import paviaFetcher from "./tokens/pavia";
import prsprFetcher from "./tokens/prspr";
import rjvFetcher from "./tokens/rjv";
Expand Down Expand Up @@ -158,4 +159,5 @@ export const supplyFetchers: Record<string, SupplyFetcher> = {
bubbleFetcher,
"09f5f55fcad17503e6b7acc81de7c80f84b76e76d17085f0e32f1ce241574f4f":
awooFetcher,
"1ddcb9c9de95361565392c5bdff64767492d61a96166cb16094e54be4f5054": optFetcher,
};
25 changes: 25 additions & 0 deletions src/tokens/opt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defaultFetcherOptions, SupplyFetcher } from "../types";
import { getAmountInAddresses, getBlockFrostInstance } from "../utils";

const OPT = "1ddcb9c9de95361565392c5bdff64767492d61a96166cb16094e54be4f5054";
const TREASURY_ADDRESSES = [
"addr1q8cjej0sez2llnke25w5lsnl7yzvd6c7vs8hmkh302ykzznu0lpva8y4km9tc06ww203c9k5xsh50q02fewjv09ce8ksj6ghfd",
"addr1q99cks4wwpxc4qltj38jyp3a6g6gp2peyx0eukfxutjv6l9gu0v3jhfq2vwmwdjg707d8ts52a4gl4vh3ygn6ywv5cls8m278u",
"addr1qxza4j8v9dyn5ryx3z2d7la3tcqt4jklmvsw93373u5zysr654zt2jmqqngtplzkxw9eg5cggk4uy4css2fmdt0tz6gsjhe5xu",
"addr1vxfa8dwzflct4re7qn2ls7t46w6rc479rafnwzqx4z2asuq6cg00t",
"stake1uxtw5rd9pw6x7npyjh0pygfemlh9f2awyfmejduwuye6efge8shl2",
];

const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => {
const blockFrost = getBlockFrostInstance(options);
const total = 45e6; // 45 million
const treasury =
Number(await getAmountInAddresses(blockFrost, OPT, TREASURY_ADDRESSES)) /
1e6;
return {
circulating: (total - treasury).toString(),
total: total.toString(),
};
};

export default fetcher;