diff --git a/api/supply.ts b/api/supply.ts index b99193f..c07904e 100644 --- a/api/supply.ts +++ b/api/supply.ts @@ -1,21 +1,20 @@ import { NowRequest, NowResponse } from "@vercel/node"; import { - getBurnedSupply, + getDeadSupply, getLockedCake, - getTotalSupply, + getTotalMint, planetFinanceBurnedTokensWei, maxSupply, getVeCakeLocked, } from "../utils/supply"; import formatNumber from "../utils/formatNumber"; -import BigNumber from "bignumber.js"; export default async (req: NowRequest, res: NowResponse): Promise => { - let totalSupply = await getTotalSupply(); - totalSupply = totalSupply.div(1e18); + let totalMint = await getTotalMint(); + totalMint = totalMint.div(1e18); - let burnedSupply = await getBurnedSupply(); - burnedSupply = burnedSupply.div(1e18); + let deadSupply = await getDeadSupply(); + deadSupply = deadSupply.div(1e18); let lockedCakePool = await getLockedCake(); lockedCakePool = lockedCakePool.div(1e18); @@ -23,34 +22,34 @@ export default async (req: NowRequest, res: NowResponse): Promise => { let lockedVeCake = await getVeCakeLocked(); lockedVeCake = lockedVeCake.div(1e18); - let lockedCake = lockedCakePool.plus(lockedVeCake); + let totalLockedCake = lockedCakePool.plus(lockedVeCake); const planetFinanceBurnedTokens = planetFinanceBurnedTokensWei.div(1e18); - const totalBurnedTokens = burnedSupply.plus(planetFinanceBurnedTokens); + const totalBurnedTokens = deadSupply.plus(planetFinanceBurnedTokens); - const burnedAndLockedTokens = totalBurnedTokens.plus(lockedCake); + const burnedAndLockedTokens = totalBurnedTokens.plus(totalLockedCake); - const unburntCake = totalSupply.minus(totalBurnedTokens); + const totalSupply = totalMint.minus(totalBurnedTokens); - const circulatingSupply = totalSupply.minus(burnedAndLockedTokens); + const circulatingSupply = totalMint.minus(burnedAndLockedTokens); if (req.query?.q === "totalSupply") { - res.json(unburntCake.toNumber()); + res.json(totalSupply.toNumber()); } else if (req.query?.q === "circulatingSupply") { res.json(circulatingSupply.toNumber()); } else if (req.query?.verbose) { res.json({ - totalMinted: formatNumber(totalSupply.toNumber()), - totalSupply: formatNumber(unburntCake.toNumber()), - burnedSupply: formatNumber(burnedSupply.toNumber()), + totalMinted: formatNumber(totalMint.toNumber()), + totalSupply: formatNumber(totalSupply.toNumber()), + burnedSupply: formatNumber(totalBurnedTokens.toNumber()), circulatingSupply: formatNumber(circulatingSupply.toNumber()), - lockedCake: formatNumber(lockedCake.toNumber()), + lockedCake: formatNumber(totalLockedCake.toNumber()), maxSupply: formatNumber(maxSupply), }); } else { res.json({ - totalSupply: unburntCake.toNumber(), + totalSupply: totalSupply.toNumber(), burnedSupply: totalBurnedTokens.toNumber(), circulatingSupply: circulatingSupply.toNumber(), }); diff --git a/utils/abis/veCake.json b/utils/abis/veCake.json new file mode 100644 index 0000000..b09eb60 --- /dev/null +++ b/utils/abis/veCake.json @@ -0,0 +1,1989 @@ +[ + { + "inputs": [ + { + "internalType": "contract ICakePool", + "name": "_cakePool", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract IProxyForCakePoolFactory", + "name": "_ProxyForCakePoolFactory", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "name": "DelegateFromCakePool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "locker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "lockTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lockType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "locker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "EarlyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "EmergencyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "InjectToDelegator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "proxy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "name": "MigrateFromCakePool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "name": "MigrationConvertToDelegation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "farmBooster", + "type": "address" + } + ], + "name": "NewFarmBooster", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Redistribute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "previousBreaker", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "breaker", + "type": "uint256" + } + ], + "name": "SetBreaker", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "oldEarlyWithdrawFeeBps", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newEarlyWithdrawFeeBps", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "oldRedistributeBps", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newRedistribiteBps", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "address", + "name": "oldTreasuryAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTreasuryAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "oldRedistributeAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newRedistributeAddr", + "type": "address" + } + ], + "name": "SetEarlyWithdrawConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "SetEarlyWithdrawSwitch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "SetEmergencyWithdrawSwitch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "SetLimitTimeOfConvert", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "SetNoPenaltyForEarlyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "ok", + "type": "bool" + } + ], + "name": "SetWhitelistedCaller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "ok", + "type": "bool" + } + ], + "name": "SetWhitelistedRedistributors", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "previousSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "name": "Supply", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isDelegator", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint40", + "name": "limitTimestampForEarlyWithdraw", + "type": "uint40" + } + ], + "name": "UpdateDelegator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "locker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "WithdrawAll", + "type": "event" + }, + { + "inputs": [], + "name": "ACTION_CREATE_LOCK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ACTION_DEPOSIT_FOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ACTION_INCREASE_LOCK_AMOUNT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ACTION_INCREASE_UNLOCK_TIME", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CakePool", + "outputs": [ + { + "internalType": "contract ICakePool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DELEGATION_FROM_CAKE_POOL_FLAG", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DELEGATOR_FLAG", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FarmBooster", + "outputs": [ + { + "internalType": "contract IFarmBooster", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_LOCK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIGRATION_FROM_CAKE_POOL_FLAG", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MULTIPLIER", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NOT_DELEGATOR_FLAG", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NOT_WITHDRAW_FLAG", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ProxyForCakePoolFactory", + "outputs": [ + { + "internalType": "contract IProxyForCakePoolFactory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WEEK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WITHDREW_FLAG", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accumRedistribute", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "balanceOfAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "balanceOfAtForProxy", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "balanceOfAtTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "balanceOfAtUser", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "balanceOfForProxy", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "balanceOfUser", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "breaker", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "checkpoint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unlockTime", + "type": "uint256" + } + ], + "name": "createLock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unlockTime", + "type": "uint256" + } + ], + "name": "createLockForProxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "delegateFromCakePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegator", + "outputs": [ + { + "internalType": "uint104", + "name": "delegatedCakeAmount", + "type": "uint104" + }, + { + "internalType": "uint104", + "name": "notInjectedCakeAmount", + "type": "uint104" + }, + { + "internalType": "uint40", + "name": "limitTimestampForEarlyWithdraw", + "type": "uint40" + }, + { + "internalType": "uint8", + "name": "isDelegator", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lockDuration", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_for", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "depositFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "earlyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "earlyWithdrawBpsPerWeek", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "earlyWithdrawSwitch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "emergencyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "emergencyWithdrawSwitch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "everEmergencyWithdraw", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "getUserInfo", + "outputs": [ + { + "internalType": "int128", + "name": "amount", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + }, + { + "internalType": "address", + "name": "cakePoolProxy", + "type": "address" + }, + { + "internalType": "uint128", + "name": "cakeAmount", + "type": "uint128" + }, + { + "internalType": "uint48", + "name": "lockEndTime", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "migrationTime", + "type": "uint48" + }, + { + "internalType": "uint16", + "name": "cakePoolType", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "withdrawFlag", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "increaseLockAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newUnlockTime", + "type": "uint256" + } + ], + "name": "increaseUnlockTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialization", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initializeCakePoolMigration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "injectToDelegator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isCakePoolProxy", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "limitTimeOfConvert", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "locks", + "outputs": [ + { + "internalType": "int128", + "name": "amount", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "migrateFromCakePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + } + ], + "name": "migrationConvertToDelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "noPenaltyForEarlyWithdraw", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "pointHistory", + "outputs": [ + { + "internalType": "int128", + "name": "bias", + "type": "int128" + }, + { + "internalType": "int128", + "name": "slope", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "redistribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "redistributeAddr", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "redistributeBps", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_breaker", + "type": "uint256" + } + ], + "name": "setBreaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "_newEarlyWithdrawBpsPerWeek", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "_newRedistributeBps", + "type": "uint64" + }, + { + "internalType": "address", + "name": "_newTreasuryAddr", + "type": "address" + }, + { + "internalType": "address", + "name": "_newRedistributeAddr", + "type": "address" + } + ], + "name": "setEarlyWithdrawConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_earlyWithdrawSwitch", + "type": "bool" + } + ], + "name": "setEarlyWithdrawSwitch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_emergencyWithdrawSwitch", + "type": "bool" + } + ], + "name": "setEmergencyWithdrawSwitch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_farmBooster", + "type": "address" + } + ], + "name": "setFarmBooster", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_limitTime", + "type": "uint256" + } + ], + "name": "setLimitTimeOfConvert", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "bool", + "name": "_status", + "type": "bool" + } + ], + "name": "setNoPenaltyForEarlyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "callers", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "ok", + "type": "bool" + } + ], + "name": "setWhitelistedCallers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "callers", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "ok", + "type": "bool" + } + ], + "name": "setWhitelistedRedistributors", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "slopeChanges", + "outputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "supply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "totalSupplyAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "totalSupplyAtTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryAddr", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isDelegator", + "type": "bool" + }, + { + "internalType": "uint40", + "name": "_limitTimestampForEarlyWithdraw", + "type": "uint40" + } + ], + "name": "updateDelegator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userInfo", + "outputs": [ + { + "internalType": "address", + "name": "cakePoolProxy", + "type": "address" + }, + { + "internalType": "uint128", + "name": "cakeAmount", + "type": "uint128" + }, + { + "internalType": "uint48", + "name": "lockEndTime", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "migrationTime", + "type": "uint48" + }, + { + "internalType": "uint16", + "name": "cakePoolType", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "withdrawFlag", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userPointEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "userPointHistory", + "outputs": [ + { + "internalType": "int128", + "name": "bias", + "type": "int128" + }, + { + "internalType": "int128", + "name": "slope", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "whitelistedCallers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "whitelistedRedistributors", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "withdrawAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/utils/supply.ts b/utils/supply.ts index 08360c6..622deb1 100644 --- a/utils/supply.ts +++ b/utils/supply.ts @@ -3,18 +3,20 @@ import { getContract } from "./web3"; import { CAKE, DEAD, LOCKED_CAKE_POOL, VECAKE } from "./constants"; import bep20 from "./abis/bep20.json"; import lockedCakePool from "./abis/lockedCakePool.json"; +import veCake from "./abis/veCake.json"; -const contract = getContract(bep20, CAKE); +const cakeContract = getContract(bep20, CAKE); +const veCakeContract = getContract(veCake, VECAKE); const lockedCakePoolContract = getContract(lockedCakePool, LOCKED_CAKE_POOL); -export const getTotalSupply = async (): Promise => { - const supply = await contract.methods.totalSupply().call(); +export const getTotalMint = async (): Promise => { + const supply = await cakeContract.methods.totalSupply().call(); return new BigNumber(supply); }; -export const getBurnedSupply = async (): Promise => { - const balance = await contract.methods.balanceOf(DEAD).call(); +export const getDeadSupply = async (): Promise => { + const balance = await cakeContract.methods.balanceOf(DEAD).call(); return new BigNumber(balance); }; @@ -25,7 +27,7 @@ export const getLockedCake = async (): Promise => { }; export const getVeCakeLocked = async (): Promise => { - const balance = await contract.methods.balanceOf(VECAKE).call(); + const balance = await veCakeContract.methods.supply().call(); return new BigNumber(balance); };