update pools, fix calculations
This commit is contained in:
@@ -25,6 +25,292 @@ export const pools: PoolConfig[] = [
|
|||||||
sortOrder: 1,
|
sortOrder: 1,
|
||||||
isFinished: false,
|
isFinished: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sousId: 220,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.chess,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x4D1Ec426d0d7fb6bF344Dd372d0502EDD71c8d88",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.0861",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 219,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.tlos,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xCB41a72067c227D6Ed7bc7CFAcd13eCe47Dfe5E9",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.3616",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 218,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.stephero,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xcecba456fefe5b18d43df23419e7ab755b436655",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.1851",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 217,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.bp,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x8ed7acf12b08274d5cdaf03d43d0e54bcbdd487e",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.217",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 216,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.cvp,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xC4b15117BC0be030c20754FF36197641477af5d1",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.14",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 215,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.qbt,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xB72dEf58D0832f747d6B7197471Fe20AeA7EB463",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "1.412",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 214,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.naos,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xb38b78529bCc895dA16CE2978D6cD6C56e8CfFC3",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.1736",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 213,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.pha,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x2E101b5F7f910F2609e5AcE5f43bD274b1DE09AA",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.28",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 212,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.bel,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x52733Ad7b4D09BF613b0389045e33E2F287afa04",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.101",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 211,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.ramp,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x401b9b97bdbc3197c1adfab9652dc78040bd1e13",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.9837",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 210,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.pots,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xBeDb490970204cb3CC7B0fea94463BeD67d5364D",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.0868",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 209,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.tusd,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xb6e510ae2da1ab4e350f837c70823ab75091780e",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.5787",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 208,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.revv,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x8aa5b2c67852ed5334c8a7f0b5eb0ef975106793",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "1.331",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 207,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.btt,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x3b804460c3c62f0f565af593984159f13b1ac976",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "263",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 206,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.skill,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x455f4d4cc4d6ca15441a93c631e82aaf338ad843",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.00289",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 205,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.win,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xde4aef42bb27a2cb45c746acde4e4d8ab711d27c",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "1815.39",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 204,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.if,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x57d3524888ded4085d9124a422f13b27c8a43de7",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.02835",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 203,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.sps,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xb56299d8fbf46c509014b103a164ad1fc65ea222",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "12.86",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 202,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.c98,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x5e49531BA07bE577323e55666D46C6217164119E",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "1.7361",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 201,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.axs,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0xBB472601B3CB32723d0755094BA80B73F67f2AF3",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.00744",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 200,
|
||||||
|
stakingToken: tokens.axs,
|
||||||
|
earningToken: tokens.cake,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x583A36816F3b8401C4fdf682203E0caDA6997740",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.00992",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sousId: 199,
|
||||||
|
stakingToken: tokens.cake,
|
||||||
|
earningToken: tokens.pmon,
|
||||||
|
contractAddress: {
|
||||||
|
97: "",
|
||||||
|
56: "0x28050e8f024e05f9ddbef5f60dd49f536dba0cf0",
|
||||||
|
},
|
||||||
|
poolCategory: PoolCategory.CORE,
|
||||||
|
harvest: true,
|
||||||
|
sortOrder: 999,
|
||||||
|
tokenPerBlock: "0.02696",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
sousId: 198,
|
sousId: 198,
|
||||||
stakingToken: tokens.cake,
|
stakingToken: tokens.cake,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -39,14 +39,14 @@ export const Pool: FC<PoolProps> = ({ pool, balance }) => {
|
|||||||
const aprValue = getApr({
|
const aprValue = getApr({
|
||||||
rewardTokenPrice: earningPrice,
|
rewardTokenPrice: earningPrice,
|
||||||
stakingTokenPrice: stakingPrice,
|
stakingTokenPrice: stakingPrice,
|
||||||
tokenPerBlock: parseFloat(pool.tokenPerBlock) / 1e-18,
|
tokenPerBlock: parseFloat(pool.tokenPerBlock),
|
||||||
totalStaked,
|
totalStaked,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (aprValue) {
|
if (aprValue) {
|
||||||
setApr({
|
setApr({
|
||||||
loading: false,
|
loading: false,
|
||||||
value: (aprValue - INVESTMENT_FEE_PERCENTAGE).toFixed(2),
|
value: (aprValue * (1 - INVESTMENT_FEE_PERCENTAGE / 100)).toFixed(2),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@@ -82,11 +82,11 @@ export const Pool: FC<PoolProps> = ({ pool, balance }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mt-4 p-2">
|
<div className="mt-4 p-2">
|
||||||
<p>
|
<p>
|
||||||
<span className="font-medium">Investir:</span>
|
<span className="font-medium mr-1">Investir:</span>
|
||||||
{pool.stakingToken.symbol}
|
{pool.stakingToken.symbol}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span className="font-medium">Receber:</span>
|
<span className="font-medium mr-1">Receber:</span>
|
||||||
{pool.earningToken.symbol}
|
{pool.earningToken.symbol}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import BigNumber from "bignumber.js";
|
|||||||
import { BLOCKS_PER_YEAR } from "../constants";
|
import { BLOCKS_PER_YEAR } from "../constants";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
stakingTokenPrice: number;
|
stakingTokenPrice: BigNumber;
|
||||||
rewardTokenPrice: number;
|
rewardTokenPrice: BigNumber;
|
||||||
totalStaked: number;
|
totalStaked: number;
|
||||||
tokenPerBlock: number;
|
tokenPerBlock: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
import type { Contract } from "ethers";
|
import type { Contract } from "ethers";
|
||||||
import { ethers } from "ethers";
|
import { ethers } from "ethers";
|
||||||
|
import BigNumber from "bignumber.js";
|
||||||
|
|
||||||
import { tokens } from "../constants/pancake/Tokens";
|
import { tokens } from "../constants/pancake/Tokens";
|
||||||
import type { Token } from "../constants/pancake/Tokens";
|
import type { Token } from "../constants/pancake/Tokens";
|
||||||
|
import { BIG_TEN } from "./getTotalStaked";
|
||||||
|
|
||||||
// 1 Wei = 1*10^18 Ether
|
// 1 Wei = 1*10^18 Ether
|
||||||
const ONE_BUSD_IN_WEI = ethers.utils.parseUnits("1", 18);
|
const ONE_BUSD_IN_WEI = ethers.utils.parseUnits("1", 18);
|
||||||
|
|
||||||
export const getPriceInBusd = async (router: Contract, token: Token) => {
|
export const getPriceInBusd = async (router: Contract, token: Token) => {
|
||||||
try {
|
const response = await fetch(
|
||||||
const result = await router.getAmountsOut(ONE_BUSD_IN_WEI, [
|
`https://api.pancakeswap.info/api/v2/tokens/${token.address["56"]}`
|
||||||
token.address["56"],
|
).then((r) => r.json());
|
||||||
tokens.busd.address["56"],
|
|
||||||
]);
|
|
||||||
|
|
||||||
return result[1].toString() / 1e18;
|
return new BigNumber(response.data.price);
|
||||||
} catch {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import BigNumber from "bignumber.js";
|
|||||||
import erc20 from "../abi/erc20.json";
|
import erc20 from "../abi/erc20.json";
|
||||||
import type { PoolConfig } from "../types";
|
import type { PoolConfig } from "../types";
|
||||||
|
|
||||||
|
export const BIG_TEN = new BigNumber(10);
|
||||||
|
|
||||||
export const getTotalStaked = async (
|
export const getTotalStaked = async (
|
||||||
provider: ethers.providers.Provider,
|
provider: ethers.providers.Provider,
|
||||||
pool: PoolConfig
|
pool: PoolConfig
|
||||||
@@ -22,7 +24,9 @@ export const getTotalStaked = async (
|
|||||||
try {
|
try {
|
||||||
const result = await contract.balanceOf(pool.contractAddress["56"]);
|
const result = await contract.balanceOf(pool.contractAddress["56"]);
|
||||||
|
|
||||||
return new BigNumber(result.toJSON().hex).toNumber();
|
return new BigNumber(result.toJSON().hex)
|
||||||
|
.dividedBy(BIG_TEN.pow(pool.stakingToken.decimals))
|
||||||
|
.toNumber();
|
||||||
} catch {
|
} catch {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user