Skip to content

Commit

Permalink
feat: include reg tokens locked inside the incentive vault
Browse files Browse the repository at this point in the history
  • Loading branch information
jycssu-com committed Nov 9, 2024
1 parent 04dbf13 commit 38e205e
Show file tree
Hide file tree
Showing 4 changed files with 755 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/hooks/useREG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import {
} from 'src/store/features/settings/settingsSelector'
import { REGRealtoken } from 'src/store/features/wallets/walletsSelector'
import { ERC20ABI } from 'src/utils/blockchain/abi/ERC20ABI'
import { RegVaultABI } from 'src/utils/blockchain/abi/RegVaultABI'
import {
DEFAULT_REG_PRICE,
HoneySwapFactory_Address,
REG_ContractAddress,
REG_VaultContractAddress,
REG_asset_ID,
REGtokenDecimals,
USDConXdai_ContractAddress,
Expand All @@ -27,6 +29,7 @@ import {
averageValues,
getUniV2AssetPrice,
} from 'src/utils/blockchain/poolPrice'
import { getAddressesLockedBalances } from 'src/utils/blockchain/regVault'

const getREG = async (
addressList: string[],
Expand All @@ -43,11 +46,18 @@ const getREG = async (
ERC20ABI,
GnosisRpcProvider,
)
const totalAmount = await getAddressesBalances(
const availableBalance = await getAddressesBalances(
REG_ContractAddress,
addressList,
providers,
)
const lockedBalance = await getAddressesLockedBalances(
REG_VaultContractAddress,
addressList,
providers,
)

const totalAmount = availableBalance + lockedBalance
const contractRegTotalSupply = await RegContract_Gnosis.totalSupply()
const totalTokens = Number(contractRegTotalSupply) / 10 ** REGtokenDecimals
const amount = totalAmount / 10 ** REGtokenDecimals
Expand Down
Loading

0 comments on commit 38e205e

Please sign in to comment.