Skip to content

Commit

Permalink
Merge pull request #19 from TLX-Protocol/exclude-voter-balance
Browse files Browse the repository at this point in the history
🚀  Exclude Velodrome Voter Automation from Circulating Supply
  • Loading branch information
chase-manning authored Jul 17, 2024
2 parents 218f073 + 50ab8da commit 4b42b26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions functions/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Vesting = "0xebd707214ea4bae19e826f14ec2a82d1b44a75f3";
export const ZapSwap = "0x461aB832D11A7B18CC444B7C92a1E2B8877A327A";
export const VelodromePool = "0x6eA20Dbc05f58ED607c374e545BFb402d5796770";
export const AmmDistributor = "0x9d27E96B3564e51422C1f0592f42b3934f2bd056";
export const VelodromeVoterAutomation = "0x3B413D27d373bC04e196b59E117E07842258007d";

// Endpoints
export const OPTIMISM_RPC = "https://mainnet.optimism.io/";
18 changes: 14 additions & 4 deletions functions/src/supply.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { Contract, Interface, JsonRpcProvider } from "ethers";
import { Airdrop, AmmDistributor, Bonding, GenesisLocker, MAX_SUPPLY, OPTIMISM_RPC, TLX, Vesting } from "./constants";
import {
Airdrop,
AmmDistributor,
Bonding,
GenesisLocker,
MAX_SUPPLY,
OPTIMISM_RPC,
TLX,
VelodromeVoterAutomation,
Vesting,
} from "./constants";

import bigintToNumber from "./helpers/bigint-to-number";

Expand All @@ -10,14 +20,14 @@ const lockerAbi = new Interface(["function totalStaked() view returns (uint256)"
const locker = new Contract(GenesisLocker, lockerAbi, provider);

export const getCirculatingSupply = async () => {
const EXCLUDED_ADDRESSES = [Airdrop, Bonding, GenesisLocker, Vesting, AmmDistributor];
const EXCLUDED_ADDRESSES = [Airdrop, Bonding, GenesisLocker, Vesting, AmmDistributor, VelodromeVoterAutomation];

const [airdropBalance, bondingBalance, genesisLockerBalance, vestingBalance, ammBalance, totalStaked] =
const [airdropBalance, bondingBalance, genesisLockerBalance, vestingBalance, ammBalance, voterBalance, totalStaked] =
await Promise.all([...EXCLUDED_ADDRESSES.map((address) => tlx.balanceOf(address)), locker.totalStaked()]);

const lockedAmount = genesisLockerBalance - totalStaked;

const totalExcluded = airdropBalance + bondingBalance + lockedAmount + vestingBalance + ammBalance;
const totalExcluded = airdropBalance + bondingBalance + lockedAmount + vestingBalance + ammBalance + voterBalance;

return MAX_SUPPLY - bigintToNumber(totalExcluded);
};
Expand Down

0 comments on commit 4b42b26

Please sign in to comment.