Skip to content

Commit

Permalink
feat: Add vecake lock amount (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xjojoex authored Dec 29, 2023
1 parent 6299dbb commit de8c97b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 8 additions & 2 deletions api/supply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getTotalSupply,
planetFinanceBurnedTokensWei,
maxSupply,
getVeCakeLocked,
} from "../utils/supply";
import formatNumber from "../utils/formatNumber";
import BigNumber from "bignumber.js";
Expand All @@ -16,8 +17,13 @@ export default async (req: NowRequest, res: NowResponse): Promise<void> => {
let burnedSupply = await getBurnedSupply();
burnedSupply = burnedSupply.div(1e18);

let lockedCake = await getLockedCake();
lockedCake = lockedCake.div(1e18);
let lockedCakePool = await getLockedCake();
lockedCakePool = lockedCakePool.div(1e18);

let lockedVeCake = await getVeCakeLocked();
lockedVeCake = lockedVeCake.div(1e18);

let lockedCake = lockedCakePool.plus(lockedVeCake);

const planetFinanceBurnedTokens = planetFinanceBurnedTokensWei.div(1e18);

Expand Down
2 changes: 2 additions & 0 deletions utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ export const WBNB_TOKEN = new Token(ChainId.MAINNET, WBNB, 18);
export const CAKE_BNB_TOKEN = new Token(ChainId.MAINNET, CAKE_BNB_FARM, 18);

export const LOCKED_CAKE_POOL = "0x45c54210128a065de780C4B0Df3d16664f7f859e";

export const VECAKE = "0x5692DB8177a81A6c6afc8084C2976C9933EC1bAB";
7 changes: 6 additions & 1 deletion utils/supply.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BigNumber from "bignumber.js";
import { getContract } from "./web3";
import { CAKE, DEAD, LOCKED_CAKE_POOL } from "./constants";
import { CAKE, DEAD, LOCKED_CAKE_POOL, VECAKE } from "./constants";
import bep20 from "./abis/bep20.json";
import lockedCakePool from "./abis/lockedCakePool.json";

Expand All @@ -24,6 +24,11 @@ export const getLockedCake = async (): Promise<BigNumber> => {
return new BigNumber(lockedAmount);
};

export const getVeCakeLocked = async (): Promise<BigNumber> => {
const balance = await contract.methods.balanceOf(VECAKE).call();
return new BigNumber(balance);
};

/**
* User (Planet Finance) built a contract on top of our original manual CAKE pool,
* but the contract was written in such a way that when we performed the migration from Masterchef v1 to v2, the tokens were stuck.
Expand Down

1 comment on commit de8c97b

@vercel
Copy link

@vercel vercel bot commented on de8c97b Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.