From d71ee1c3cb6a13ae0a1d35f7754f0796ec4133c0 Mon Sep 17 00:00:00 2001 From: Worrex <68468180+worrex@users.noreply.github.com> Date: Fri, 23 Jun 2023 15:39:38 +0200 Subject: [PATCH] Feature/chihuahua integration (#267) * feature(chihuahua-integration): incentives and bonding Restructured chain config for bonding and incentives * feature(chihuahua-integration): checks included Do not show Force Epoch button if genesis time havent been reached Do not show take snapshots when wallet not connected * feature(chihuahua-integration): retrieving new cosmwasm client when switching chain in useCosmwasmClient.ts Clear cache of queryClient when switching chain * feature(chihuahua-integration): disabling incentives --- .../Pages/BondingActions/BondingActions.tsx | 15 ++-- components/Pages/BondingActions/Withdraw.tsx | 2 +- .../Pages/BondingActions/hooks/bondTokens.ts | 2 +- .../BondingActions/hooks/createNewEpoch.ts | 2 +- .../BondingActions/hooks/unbondTokens.ts | 2 +- .../BondingActions/hooks/withdrawTokens.ts | 2 +- components/Pages/Dashboard/Dashboard.tsx | 17 +++-- .../Pages/Dashboard/RewardsComponent.tsx | 22 ++++-- .../Pages/Dashboard/hooks/claimRewards.ts | 2 +- components/Pages/Dashboard/hooks/getBonded.ts | 2 +- .../Pages/Dashboard/hooks/getBondingConfig.ts | 2 +- .../Pages/Dashboard/hooks/getClaimable.ts | 2 +- .../Dashboard/hooks/getClaimableEpochs.ts | 2 +- .../Pages/Dashboard/hooks/getCurrentEpoch.ts | 4 +- .../Pages/Dashboard/hooks/getEpochById.ts | 70 ------------------- .../hooks/getFeeDistributorConfig.ts | 2 +- .../Pages/Dashboard/hooks/getTotalBonded.ts | 2 +- .../Pages/Dashboard/hooks/getUnbonding.ts | 2 +- components/Pages/Dashboard/hooks/getWeight.ts | 2 +- .../Pages/Dashboard/hooks/getWithdrawable.ts | 2 +- .../Pages/Dashboard/hooks/useDashboardData.ts | 11 +-- .../Pages/Incentivize/hooks/useEpoch.ts | 19 ++--- .../Incentivize/hooks/useIncentiveConfig.ts | 41 ----------- .../Incentivize/hooks/useIncentivePoolInfo.ts | 10 +-- .../Pages/Incentivize/hooks/useOpenFlow.ts | 18 +++-- .../hooks/useQueryIncentiveContracts.ts | 19 +++-- components/Pages/Liquidity/Claim.tsx | 5 +- components/Pages/Liquidity/DepositForm.tsx | 17 ++--- .../Pages/Liquidity/ManageLiquidity.tsx | 12 +++- .../hooks/useCheckIncentiveSnapshots.ts | 7 +- .../hooks/useForceEpochAndTakingSnapshots.ts | 6 +- .../Pages/Liquidity/hooks/useProvideLP.ts | 23 +++--- components/Pages/Pools/ActionCTAs.tsx | 10 ++- components/Pages/Pools/Pools.tsx | 16 +++-- .../ChainSelect/ChainList/ChainItem.tsx | 2 +- constants/bonding_contract.ts | 6 +- hooks/useCosmwasmClient.ts | 25 +++---- public/mainnet/chihuahua-1/config.json | 24 +++++++ public/mainnet/chihuahua-1/pools_list.json | 22 +++--- public/mainnet/phoenix-1/bonding_config.json | 22 ------ public/mainnet/phoenix-1/config.json | 24 +++++++ .../mainnet/phoenix-1/incentive_config.json | 5 -- public/testnet/narwhal-1/bonding_config.json | 22 ------ public/testnet/narwhal-1/config.json | 24 +++++++ .../testnet/narwhal-1/incentive_config.json | 4 -- util/wallet-adapters/terraStationWallet.ts | 2 +- 46 files changed, 248 insertions(+), 306 deletions(-) delete mode 100644 components/Pages/Dashboard/hooks/getEpochById.ts delete mode 100644 components/Pages/Incentivize/hooks/useIncentiveConfig.ts create mode 100644 public/mainnet/chihuahua-1/config.json delete mode 100644 public/mainnet/phoenix-1/bonding_config.json create mode 100644 public/mainnet/phoenix-1/config.json delete mode 100644 public/mainnet/phoenix-1/incentive_config.json delete mode 100644 public/testnet/narwhal-1/bonding_config.json create mode 100644 public/testnet/narwhal-1/config.json delete mode 100644 public/testnet/narwhal-1/incentive_config.json diff --git a/components/Pages/BondingActions/BondingActions.tsx b/components/Pages/BondingActions/BondingActions.tsx index 6e12cc42..3fea2f95 100644 --- a/components/Pages/BondingActions/BondingActions.tsx +++ b/components/Pages/BondingActions/BondingActions.tsx @@ -32,8 +32,8 @@ import { useConfig, useDashboardData, } from '../Dashboard/hooks/useDashboardData' -import { usePriceForOneToken } from 'features/swap/index' import { BondingActionTooltip } from 'components/Pages/BondingActions/BondingAcionTooltip' +import usePrices from 'hooks/usePrices' export enum WhaleTokenType { ampWHALE, @@ -66,11 +66,14 @@ const BondingActions = ({ globalAction }) => { const { balance: liquidBWhale } = useTokenBalance(B_WHALE_TOKEN_SYMBOL) - const whalePrice = - usePriceForOneToken({ - tokenASymbol: 'WHALE', - tokenBSymbol: 'axlUSDC', - })[0] || 0 + const prices = usePrices() + + const whalePrice = useMemo(() => { + if (prices && prices['WHALE']) { + return prices['WHALE'] + } + return 0 // Default value + }, [prices]) const { bondedAmpWhale, diff --git a/components/Pages/BondingActions/Withdraw.tsx b/components/Pages/BondingActions/Withdraw.tsx index dc4c3393..aeb9ecc4 100644 --- a/components/Pages/BondingActions/Withdraw.tsx +++ b/components/Pages/BondingActions/Withdraw.tsx @@ -41,7 +41,7 @@ const Withdraw = ({ } const TokenBox = ({ label, ampWhale, bWhale }) => { - const dollarValue = ((ampWhale + bWhale) * whalePrice).toLocaleString() + const dollarValue = ((ampWhale + bWhale) * whalePrice).toFixed(2) return ( { const [{ chainId, status, client, address, network }] = @@ -105,11 +105,14 @@ const Dashboard: FC = () => { setValues(TokenType.withdrawable, ampWhale + bWhale, null, ampWhale, bWhale) } - const whalePrice = - usePriceForOneToken({ - tokenASymbol: 'WHALE', - tokenBSymbol: 'axlUSDC', - })[0] || 0 + const prices = usePrices() + + const whalePrice = useMemo(() => { + if (prices && prices['WHALE']) { + return prices['WHALE'] + } + return 0 // Default value + }, [prices]) const { balance: liquidWhale } = useTokenBalance(WHALE_TOKEN_SYMBOL) const { balance: liquidAmpWhale } = useTokenBalance(AMP_WHALE_TOKEN_SYMBOL) diff --git a/components/Pages/Dashboard/RewardsComponent.tsx b/components/Pages/Dashboard/RewardsComponent.tsx index f4fbc33c..10ceffaf 100644 --- a/components/Pages/Dashboard/RewardsComponent.tsx +++ b/components/Pages/Dashboard/RewardsComponent.tsx @@ -22,8 +22,11 @@ import { ActionType } from './BondingOverview' import useTransaction, { TxStep } from '../BondingActions/hooks/useTransaction' import { BondingActionTooltip } from 'components/Pages/BondingActions/BondingAcionTooltip' import { RewardsTooltip } from 'components/Pages/Dashboard/RewardsTooltip' -import { useIncentiveConfig } from 'components/Pages/Incentivize/hooks/useIncentiveConfig' import useForceEpochAndTakingSnapshots from 'components/Pages/Liquidity/hooks/useForceEpochAndTakingSnapshots' +import { + Config, + useConfig, +} from 'components/Pages/Dashboard/hooks/useDashboardData' const pulseAnimation = keyframes` 0% { @@ -123,7 +126,7 @@ const RewardsComponent = ({ } = useDisclosure() const claimableRewards = useMemo( - () => totalGlobalClaimable * Number(weightInfo?.share), + () => totalGlobalClaimable * Number(weightInfo?.share || 0), [totalGlobalClaimable, weightInfo] ) @@ -147,7 +150,8 @@ const RewardsComponent = ({ const { txStep, submit } = useTransaction() - const { config } = useIncentiveConfig(network, chainId) + const config: Config = useConfig(network, chainId) + const forceEpochAndTakeSnapshots = useForceEpochAndTakingSnapshots({ noSnapshotTakenAddresses: null, config: config, @@ -181,6 +185,10 @@ const RewardsComponent = ({ 100 ) + const bondingHasStarted: boolean = useMemo(() => { + return genesisStartTimeInNano / 1_000_000 < Date.now() + }, [genesisStartTimeInNano]) + return ( <> {isLoading ? ( @@ -190,7 +198,7 @@ const RewardsComponent = ({ borderRadius={borderRadius} minH={320} w={450} - gap={4} + gap={3} overflow="hidden" position="relative" display="flex" @@ -238,7 +246,7 @@ const RewardsComponent = ({ WHALE - ${whalePrice.toFixed(6)} + ${whalePrice?.toFixed(6)} @@ -272,7 +280,7 @@ const RewardsComponent = ({ : 'n/a' } isWalletConnected={isWalletConnected} - whale={claimableRewards} + whale={claimableRewards.toFixed(6)} /> @@ -324,7 +332,7 @@ const RewardsComponent = ({ > {buttonLabel} - {progress === 100 && isWalletConnected && ( + {progress === 100 && isWalletConnected && bondingHasStarted && ( => { const result: JsonObject = await client.queryContractSmart( - config.whale_lair_address, + config.whale_lair, { bonded: { address: address }, } diff --git a/components/Pages/Dashboard/hooks/getBondingConfig.ts b/components/Pages/Dashboard/hooks/getBondingConfig.ts index 9c816cb2..836aedc0 100644 --- a/components/Pages/Dashboard/hooks/getBondingConfig.ts +++ b/components/Pages/Dashboard/hooks/getBondingConfig.ts @@ -33,7 +33,7 @@ export const fetchConfig = async ( config: Config ): Promise => { const result: JsonObject = await client.queryContractSmart( - config.whale_lair_address, + config.whale_lair, { config: {}, } diff --git a/components/Pages/Dashboard/hooks/getClaimable.ts b/components/Pages/Dashboard/hooks/getClaimable.ts index 0ded260e..643a089c 100644 --- a/components/Pages/Dashboard/hooks/getClaimable.ts +++ b/components/Pages/Dashboard/hooks/getClaimable.ts @@ -60,7 +60,7 @@ const fetchClaimableData = async ( config: Config ): Promise => { const result: JsonObject = await client.queryContractSmart( - config.fee_distributor_address, + config.fee_distributor, { claimable: { address: address }, } diff --git a/components/Pages/Dashboard/hooks/getClaimableEpochs.ts b/components/Pages/Dashboard/hooks/getClaimableEpochs.ts index c8ac349a..7645809b 100644 --- a/components/Pages/Dashboard/hooks/getClaimableEpochs.ts +++ b/components/Pages/Dashboard/hooks/getClaimableEpochs.ts @@ -74,7 +74,7 @@ export const fetchClaimableEpoch = async ( config: Config ): Promise => { const result: JsonObject = await client.queryContractSmart( - config.fee_distributor_address, + config.fee_distributor, { claimable_epochs: {}, } diff --git a/components/Pages/Dashboard/hooks/getCurrentEpoch.ts b/components/Pages/Dashboard/hooks/getCurrentEpoch.ts index db88bda4..b93e9557 100644 --- a/components/Pages/Dashboard/hooks/getCurrentEpoch.ts +++ b/components/Pages/Dashboard/hooks/getCurrentEpoch.ts @@ -49,8 +49,8 @@ export const fetchCurrentEpoch = async ( client: Wallet, config: Config ): Promise => { - const result: JsonObject = await client.queryContractSmart( - config.fee_distributor_address, + const result: JsonObject = await client?.queryContractSmart( + config.fee_distributor, { current_epoch: {}, } diff --git a/components/Pages/Dashboard/hooks/getEpochById.ts b/components/Pages/Dashboard/hooks/getEpochById.ts deleted file mode 100644 index 91845b33..00000000 --- a/components/Pages/Dashboard/hooks/getEpochById.ts +++ /dev/null @@ -1,70 +0,0 @@ -// import {Wallet} from "util/wallet-adapters"; -// import { -// FEE_DISTRIBUTOR_CONTRACT_ADDRESS -// } from "constants/bonding_contract"; -// import {JsonObject} from "@cosmjs/cosmwasm-stargate"; -// import {useQuery} from "react-query"; -// -// interface EpochData { -// id: string; -// start_time: string; -// total: { -// amount: string; -// info: { -// native_token: { -// denom: string; -// }; -// }; -// }[]; -// available: { -// amount: string; -// info: { -// native_token: { -// denom: string; -// }; -// }; -// }[]; -// claimed: { -// amount: string; -// info: { -// native_token: { -// denom: string; -// }; -// }; -// }[]; -// } -// interface Epoch { -// epoch: EpochData; -// } -// export const getEpochById = (client: Wallet | null, id: string ) => { -// const { -// data: currentEpoch, -// isLoading, -// refetch, -// } = useQuery( -// ['currentEpoch', client], -// () => { -// if (client) { -// return fetchEpochById(client, id); -// } else { -// return Promise.resolve(null); -// } -// }, -// { -// refetchOnMount:true, -// -// refetchIntervalInBackground: true, -// } -// ) -// -// return {currentEpoch, isLoading, refetch} -// -// } -// -// export const fetchEpochById = async (client: Wallet, id: string): Promise => { -// const result: JsonObject = await client.queryContractSmart(FEE_DISTRIBUTOR_CONTRACT_ADDRESS, { -// epoch: {id: id}, -// }); -// -// return result as Epoch; -// }; diff --git a/components/Pages/Dashboard/hooks/getFeeDistributorConfig.ts b/components/Pages/Dashboard/hooks/getFeeDistributorConfig.ts index e8dfafef..48bef596 100644 --- a/components/Pages/Dashboard/hooks/getFeeDistributorConfig.ts +++ b/components/Pages/Dashboard/hooks/getFeeDistributorConfig.ts @@ -35,7 +35,7 @@ const fetchConfig = async ( config: Config ): Promise => { const result: JsonObject = await client.queryContractSmart( - config.fee_distributor_address, + config.fee_distributor, { config: {}, } diff --git a/components/Pages/Dashboard/hooks/getTotalBonded.ts b/components/Pages/Dashboard/hooks/getTotalBonded.ts index 9066a79f..f7ed7b96 100644 --- a/components/Pages/Dashboard/hooks/getTotalBonded.ts +++ b/components/Pages/Dashboard/hooks/getTotalBonded.ts @@ -41,7 +41,7 @@ const fetchTotalBonded = async ( config: Config ): Promise => { const result: JsonObject = await client.queryContractSmart( - config.whale_lair_address, + config.whale_lair, { total_bonded: {}, } diff --git a/components/Pages/Dashboard/hooks/getUnbonding.ts b/components/Pages/Dashboard/hooks/getUnbonding.ts index 2ef827cc..6951e06d 100644 --- a/components/Pages/Dashboard/hooks/getUnbonding.ts +++ b/components/Pages/Dashboard/hooks/getUnbonding.ts @@ -92,7 +92,7 @@ const fetchUnbonding = async ( ): Promise => { const results: UnbondingInfo[] = await Promise.all( Object.entries(config.lsd_token).map(async ([key, token]) => { - return await client.queryContractSmart(config.whale_lair_address, { + return await client.queryContractSmart(config.whale_lair, { unbonding: { address: address, denom: token.denom }, }) }) diff --git a/components/Pages/Dashboard/hooks/getWeight.ts b/components/Pages/Dashboard/hooks/getWeight.ts index 36177839..abcf58ff 100644 --- a/components/Pages/Dashboard/hooks/getWeight.ts +++ b/components/Pages/Dashboard/hooks/getWeight.ts @@ -33,7 +33,7 @@ const fetchWeight = async ( config: Config ): Promise => { const result: JsonObject = await client.queryContractSmart( - config.whale_lair_address, + config.whale_lair, { weight: { address: address }, } diff --git a/components/Pages/Dashboard/hooks/getWithdrawable.ts b/components/Pages/Dashboard/hooks/getWithdrawable.ts index 781aaa0c..62c81a45 100644 --- a/components/Pages/Dashboard/hooks/getWithdrawable.ts +++ b/components/Pages/Dashboard/hooks/getWithdrawable.ts @@ -36,7 +36,7 @@ const fetchWithdrawable = async ( ): Promise => { const results = await Promise.all( Object.entries(config.lsd_token).map(async ([key, token]) => { - return await client.queryContractSmart(config.whale_lair_address, { + return await client.queryContractSmart(config.whale_lair, { withdrawable: { address: address, denom: token.denom }, }) }) diff --git a/components/Pages/Dashboard/hooks/useDashboardData.ts b/components/Pages/Dashboard/hooks/useDashboardData.ts index 4dbad2ea..ba0af729 100644 --- a/components/Pages/Dashboard/hooks/useDashboardData.ts +++ b/components/Pages/Dashboard/hooks/useDashboardData.ts @@ -20,8 +20,11 @@ export interface TokenDetails { } export interface Config { - whale_lair_address: string - fee_distributor_address: string + whale_lair: string + fee_distributor: string + incentive_factory: string + frontend_helper: string + whale_base_token: TokenDetails lsd_token: { ampWHALE: TokenDetails @@ -37,9 +40,7 @@ export const useConfig = (network: string, chainId: string) => { // Only execute if network and chainId are defined const fetchConfig = async () => { try { - const response = await fetch( - `/${network}/${chainId}/bonding_config.json` - ) + const response = await fetch(`/${network}/${chainId}/config.json`) const json: Config = await response.json() setConfig(json) } catch (error) { diff --git a/components/Pages/Incentivize/hooks/useEpoch.ts b/components/Pages/Incentivize/hooks/useEpoch.ts index 0f060b22..60a7ff1a 100644 --- a/components/Pages/Incentivize/hooks/useEpoch.ts +++ b/components/Pages/Incentivize/hooks/useEpoch.ts @@ -4,29 +4,32 @@ import { useQuery } from 'react-query' import { useRecoilValue } from 'recoil' import { walletState } from 'state/atoms/walletAtoms' import utc from 'dayjs/plugin/utc' -import { useIncentiveConfig } from 'components/Pages/Incentivize/hooks/useIncentiveConfig' +import { + Config, + useConfig, +} from 'components/Pages/Dashboard/hooks/useDashboardData' dayjs.extend(utc) const useEpoch = () => { const { client, network, chainId } = useRecoilValue(walletState) - const { config: incentiveConfig } = useIncentiveConfig(network, chainId) + const contracts: Config = useConfig(network, chainId) const { data: config } = useQuery({ - queryKey: ['incentive', 'config', incentiveConfig?.fee_distributor_address], + queryKey: ['incentive', 'config', contracts?.fee_distributor], queryFn: () => - client?.queryContractSmart(incentiveConfig?.fee_distributor_address, { + client?.queryContractSmart(contracts?.fee_distributor, { config: {}, }), - enabled: !!incentiveConfig && !!client, + enabled: !!contracts && !!client, }) const { data } = useQuery({ - queryKey: ['incentive', 'epoch', incentiveConfig?.fee_distributor_address], + queryKey: ['incentive', 'epoch', contracts?.fee_distributor], queryFn: () => - client?.queryContractSmart(incentiveConfig?.fee_distributor_address, { + client?.queryContractSmart(contracts?.fee_distributor, { current_epoch: {}, }), - enabled: !!incentiveConfig && !!client, + enabled: !!contracts && !!client, }) const checkLocalAndUTC = () => { diff --git a/components/Pages/Incentivize/hooks/useIncentiveConfig.ts b/components/Pages/Incentivize/hooks/useIncentiveConfig.ts deleted file mode 100644 index 785b174b..00000000 --- a/components/Pages/Incentivize/hooks/useIncentiveConfig.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { useEffect, useState } from 'react' - -export interface IncentiveConfig { - incentive_factory_address: string - fee_distributor_address: string - frontend_helper_address: string -} - -export const useIncentiveConfig = (network: string, chainId: string) => { - const [config, setConfig] = useState(null) - const [isSuccessful, setIsSuccessful] = useState(false) - - useEffect(() => { - if (network && chainId) { - // Only execute if network and chainId are defined - const fetchConfig = async () => { - try { - const response = await fetch( - `/${network}/${chainId}/incentive_config.json` - ) - - if (!response.ok) { - setIsSuccessful(false) - return - } - - const json: IncentiveConfig = await response.json() - setConfig(json) - setIsSuccessful(true) - } catch (error) { - console.error('Failed to load config:', error) - setIsSuccessful(false) - } - } - - fetchConfig() - } - }, [network, chainId]) - - return { config, isSuccessful } -} diff --git a/components/Pages/Incentivize/hooks/useIncentivePoolInfo.ts b/components/Pages/Incentivize/hooks/useIncentivePoolInfo.ts index 0396f2c1..e833c51c 100644 --- a/components/Pages/Incentivize/hooks/useIncentivePoolInfo.ts +++ b/components/Pages/Incentivize/hooks/useIncentivePoolInfo.ts @@ -52,7 +52,7 @@ export interface IncentivePoolInfo { export const useIncentivePoolInfo = ( client, pools, - currentChain + currentChainPrefix ): IncentivePoolInfo[] => { const { chainId, network } = useRecoilValue(walletState) const config: Config = useConfig(network, chainId) @@ -65,13 +65,13 @@ export const useIncentivePoolInfo = ( useEffect(() => { const fetchPoolData = async () => { const poolData = - currentChain === 'terra' + currentChainPrefix === 'terra' ? await getPairAprAndDailyVolumeTerra(pools) - : await getPairAprAndDailyVolume(pools, currentChain) + : await getPairAprAndDailyVolume(pools, currentChainPrefix) setPoolsWithAprAnd24HrVolume(poolData) } fetchPoolData() - }, [currentChain, pools?.length, client]) + }, [currentChainPrefix, pools?.length, client]) let poolAssets = [] @@ -104,7 +104,7 @@ export const useIncentivePoolInfo = ( } const fetchFlows = async (client, address): Promise => { - return await client.queryContractSmart(address, { flows: {} }) + return await client?.queryContractSmart(address, { flows: {} }) } const fetchGlobalIncentiveWeight = async ( client, diff --git a/components/Pages/Incentivize/hooks/useOpenFlow.ts b/components/Pages/Incentivize/hooks/useOpenFlow.ts index 4cc21bd0..bf7c488d 100644 --- a/components/Pages/Incentivize/hooks/useOpenFlow.ts +++ b/components/Pages/Incentivize/hooks/useOpenFlow.ts @@ -16,7 +16,10 @@ import { num, toChainAmount } from 'libs/num' import { createAsset } from 'services/asset' import useFactoryConfig from './useFactoryConfig' import useEpoch from './useEpoch' -import { useIncentiveConfig } from 'components/Pages/Incentivize/hooks/useIncentiveConfig' +import { + Config, + useConfig, +} from 'components/Pages/Dashboard/hooks/useDashboardData' interface Props { poolId: string @@ -27,7 +30,7 @@ interface Props { export const useOpenFlow = ({ poolId, token, startDate, endDate }: Props) => { const { address, client, network, chainId } = useRecoilValue(walletState) - const { config: incentiveConfig } = useIncentiveConfig(network, chainId) + const config: Config = useConfig(network, chainId) const [pool] = usePoolFromListQueryById({ poolId }) const { onError, onSuccess, onMutate } = useTxStatus({ transactionType: 'Open Flow', @@ -35,7 +38,7 @@ export const useOpenFlow = ({ poolId, token, startDate, endDate }: Props) => { }) const tokenInfo = useTokenInfo(token?.tokenSymbol) const amount = toChainAmount(token.amount, tokenInfo?.decimals || 6) - const config = useFactoryConfig(incentiveConfig?.incentive_factory_address) + const factoryConfig = useFactoryConfig(config?.incentive_factory) const { dateToEpoch } = useEpoch() const msgs = useMemo(() => { @@ -54,14 +57,17 @@ export const useOpenFlow = ({ poolId, token, startDate, endDate }: Props) => { const nativeAmount = tokenInfo?.denom === 'uwhale' - ? num(amount).plus(config?.createFlowFee?.amount).toString() + ? num(amount).plus(factoryConfig?.createFlowFee?.amount).toString() : amount const funds = [ tokenInfo?.native && coin(nativeAmount, tokenInfo?.denom), - config && + factoryConfig && tokenInfo?.denom !== 'uwhale' && - coin(config?.createFlowFee?.amount, config?.createFlowFee?.denom), + coin( + factoryConfig?.createFlowFee?.amount, + factoryConfig?.createFlowFee?.denom + ), ].filter(Boolean) const increaseAllowanceMessages: Array = [] diff --git a/components/Pages/Incentivize/hooks/useQueryIncentiveContracts.ts b/components/Pages/Incentivize/hooks/useQueryIncentiveContracts.ts index c2326ba2..17db0620 100644 --- a/components/Pages/Incentivize/hooks/useQueryIncentiveContracts.ts +++ b/components/Pages/Incentivize/hooks/useQueryIncentiveContracts.ts @@ -1,15 +1,15 @@ import { Wallet } from 'util/wallet-adapters/index' import { useQuery } from 'react-query' -import { - IncentiveConfig, - useIncentiveConfig, -} from 'components/Pages/Incentivize/hooks/useIncentiveConfig' import { useRecoilValue } from 'recoil' import { walletState } from 'state/atoms/walletAtoms' +import { + Config, + useConfig, +} from 'components/Pages/Dashboard/hooks/useDashboardData' export const useQueryIncentiveContracts = (client: Wallet): Array => { const { chainId, network } = useRecoilValue(walletState) - const { config } = useIncentiveConfig(network, chainId) + const config: Config = useConfig(network, chainId) const { data } = useQuery( ['useQueryIncentiveContracts', config], async () => await fetchIncentiveContracts(client, config), @@ -20,11 +20,10 @@ export const useQueryIncentiveContracts = (client: Wallet): Array => { const fetchIncentiveContracts = async ( client, - config: IncentiveConfig + config: Config ): Promise> => { - const data = await client.queryContractSmart( - config.incentive_factory_address, - { incentives: {} } - ) + const data = await client.queryContractSmart(config.incentive_factory, { + incentives: {}, + }) return data.map((incentive) => incentive.incentive_address) } diff --git a/components/Pages/Liquidity/Claim.tsx b/components/Pages/Liquidity/Claim.tsx index 9a35b24e..f064b3fd 100644 --- a/components/Pages/Liquidity/Claim.tsx +++ b/components/Pages/Liquidity/Claim.tsx @@ -9,8 +9,8 @@ import useRewards from './hooks/useRewards' import useForceEpochAndTakingSnapshots from 'components/Pages/Liquidity/hooks/useForceEpochAndTakingSnapshots' import { useRecoilValue } from 'recoil' import { walletState } from 'state/atoms/walletAtoms' -import { useIncentiveConfig } from 'components/Pages/Incentivize/hooks/useIncentiveConfig' import { useCheckIncentiveSnapshots } from 'components/Pages/Liquidity/hooks/useCheckIncentiveSnapshots' +import { useConfig } from 'components/Pages/Dashboard/hooks/useDashboardData' const AvailableRewards = ({ totalValue }: { totalValue: number }) => ( { const claim = useClaim({ poolId }) const { client, network, chainId } = useRecoilValue(walletState) - const { config } = useIncentiveConfig(network, chainId) + + const config = useConfig(network, chainId) // check if there are all snapshots for incentives for current taken, if not return those on which no ss was performed const noSnapshotTakenAddresses = useCheckIncentiveSnapshots(client, config) const allSnapshotsTaken = useMemo(() => { diff --git a/components/Pages/Liquidity/DepositForm.tsx b/components/Pages/Liquidity/DepositForm.tsx index f023cd7e..f8226747 100644 --- a/components/Pages/Liquidity/DepositForm.tsx +++ b/components/Pages/Liquidity/DepositForm.tsx @@ -10,7 +10,7 @@ import ShowError from 'components/ShowError' import SubmitButton from 'components/SubmitButton' import BondingDaysSlider from './BondingDaysSlider' import Multiplicator from './Multiplicator' -import { usePoolFromListQueryById } from 'queries/usePoolsListQuery' +import { INCENTIVE_ENABLED_CHAIN_IDS } from 'constants/bonding_contract' type Props = { connected: WalletStatusType @@ -21,10 +21,10 @@ type Props = { onInputChange: (asset: TokenItemState, index: number) => void setReverse: (value: boolean) => void reverse: boolean - poolId: string setBondingDays: (value: number) => void bondingDays: number clearForm: () => void + chainId: string } const DepositForm = ({ @@ -38,8 +38,8 @@ const DepositForm = ({ reverse, bondingDays, setBondingDays, - poolId, clearForm, + chainId, }: Props) => { const { control, handleSubmit, setValue, getValues } = useForm({ mode: 'onChange', @@ -49,9 +49,10 @@ const DepositForm = ({ }, }) - const [pool] = usePoolFromListQueryById({ poolId }) - - const isStakingEnabled = useMemo(() => !!pool?.staking_address, [pool]) + const incentivesEnabled = useMemo( + () => INCENTIVE_ENABLED_CHAIN_IDS.includes(chainId), + [chainId] + ) //const multiplicator = useMultiplicator(poolId) @@ -155,12 +156,12 @@ const DepositForm = ({ { ) const poolId = (router.query.poolId as string) ?? poolList?.pools[0].pool_id const prices = usePrices() - + const currentChainPrefix = useMemo( + () => + chains.find((row) => row.chainId === chainId)?.bech32Config + ?.bech32PrefixAccAddr, + [chains, chainId] + ) const incentivePoolInfos: IncentivePoolInfo[] = useIncentivePoolInfo( client, - pools + pools, + currentChainPrefix ) const pool = useMemo( @@ -233,9 +239,9 @@ const ManageLiquidity: FC = () => { tokenB={tokenB} onInputChange={onInputChange} simulated={simulated} - poolId={poolId} tx={tx} clearForm={clearForm} + chainId={chainId} /> )} diff --git a/components/Pages/Liquidity/hooks/useCheckIncentiveSnapshots.ts b/components/Pages/Liquidity/hooks/useCheckIncentiveSnapshots.ts index cc18337e..b5231a6b 100644 --- a/components/Pages/Liquidity/hooks/useCheckIncentiveSnapshots.ts +++ b/components/Pages/Liquidity/hooks/useCheckIncentiveSnapshots.ts @@ -2,12 +2,9 @@ import { useQuery } from 'react-query' import { useCurrentEpoch } from 'components/Pages/Incentivize/hooks/useCurrentEpoch' import { Wallet } from 'util/wallet-adapters/index' import { useQueryIncentiveContracts } from 'components/Pages/Incentivize/hooks/useQueryIncentiveContracts' -import { IncentiveConfig } from 'components/Pages/Incentivize/hooks/useIncentiveConfig' +import { Config } from 'components/Pages/Dashboard/hooks/useDashboardData' -export const useCheckIncentiveSnapshots = ( - client: Wallet, - config: IncentiveConfig -) => { +export const useCheckIncentiveSnapshots = (client: Wallet, config: Config) => { const { data: currentEpochData } = useCurrentEpoch(client, config) const epochId = currentEpochData?.currentEpoch?.epoch.id const incentiveAddresses = useQueryIncentiveContracts(client) diff --git a/components/Pages/Liquidity/hooks/useForceEpochAndTakingSnapshots.ts b/components/Pages/Liquidity/hooks/useForceEpochAndTakingSnapshots.ts index b5bc3c62..f834f2fe 100644 --- a/components/Pages/Liquidity/hooks/useForceEpochAndTakingSnapshots.ts +++ b/components/Pages/Liquidity/hooks/useForceEpochAndTakingSnapshots.ts @@ -4,8 +4,8 @@ import { useRecoilValue } from 'recoil' import { walletState } from 'state/atoms/walletAtoms' import { createExecuteMessage } from 'util/messages' import useTxStatus from 'hooks/useTxStatus' -import { IncentiveConfig } from 'components/Pages/Incentivize/hooks/useIncentiveConfig' import { useQueryIncentiveContracts } from 'components/Pages/Incentivize/hooks/useQueryIncentiveContracts' +import { Config } from 'components/Pages/Dashboard/hooks/useDashboardData' export enum Force { epochAndSnapshots, @@ -14,7 +14,7 @@ export enum Force { type Params = { noSnapshotTakenAddresses?: Array - config: IncentiveConfig + config: Config } const useForceEpochAndTakingSnapshots = ({ noSnapshotTakenAddresses, @@ -57,7 +57,7 @@ const useForceEpochAndTakingSnapshots = ({ new_epoch: {}, }, senderAddress: address, - contractAddress: config?.fee_distributor_address, + contractAddress: config?.fee_distributor, funds: [], }), ] diff --git a/components/Pages/Liquidity/hooks/useProvideLP.ts b/components/Pages/Liquidity/hooks/useProvideLP.ts index 4c67034e..f9c7b30d 100644 --- a/components/Pages/Liquidity/hooks/useProvideLP.ts +++ b/components/Pages/Liquidity/hooks/useProvideLP.ts @@ -10,12 +10,15 @@ import { tokenLpAtom } from '../lpAtoms' import createLpMsg, { createLPExecuteMsgs } from './createLPMsg' import useTransaction from './useDepositTransaction' import useIsNewPosition from './useIsNewPosition' -import { useIncentiveConfig } from 'components/Pages/Incentivize/hooks/useIncentiveConfig' +import { + Config, + useConfig, +} from 'components/Pages/Dashboard/hooks/useDashboardData' const useProvideLP = ({ reverse = false, bondingDays = 0 }) => { const [lpTokenA, lpTokenB] = useRecoilValue(tokenLpAtom) const { address, client, network, chainId } = useRecoilValue(walletState) - const { config: incentiveConfig } = useIncentiveConfig(network, chainId) + const config: Config = useConfig(network, chainId) const tokenInfoA = useTokenInfo(lpTokenA?.tokenSymbol) const tokenInfoB = useTokenInfo(lpTokenB?.tokenSymbol) const [matchingPools] = useQueryMatchingPoolForSwap({ @@ -31,9 +34,8 @@ const useProvideLP = ({ reverse = false, bondingDays = 0 }) => { //const [pool] = usePoolFromListQueryById({ poolId }) const isNewPosition = useIsNewPosition({ bondingDays, poolId }) - const factoryConfig = useFactoryConfig( - incentiveConfig?.incentive_factory_address - ) + + const factoryConfig = useFactoryConfig(config?.incentive_factory) let minUnbondingDuration = null if (factoryConfig) { minUnbondingDuration = factoryConfig?.minUnbondingDuration @@ -135,9 +137,7 @@ const useProvideLP = ({ reverse = false, bondingDays = 0 }) => { bondingDays, pairAddress: swapAddress, stakingProxy: - bondingDays === 0 - ? swapAddress - : incentiveConfig?.frontend_helper_address, + bondingDays === 0 ? swapAddress : config?.frontend_helper, amountA: reverse ? flipped ? tokenAAmount @@ -164,7 +164,7 @@ const useProvideLP = ({ reverse = false, bondingDays = 0 }) => { tokenB, tokenBAmount, reverse, - incentiveConfig?.frontend_helper_address, + config?.frontend_helper, bondingDays, isNewPosition, ]) @@ -173,10 +173,7 @@ const useProvideLP = ({ reverse = false, bondingDays = 0 }) => { poolId, enabled: !!encodedMsgs && Number(tokenAAmount) > 0 && Number(tokenBAmount) > 0, - swapAddress: - bondingDays === 0 - ? swapAddress - : incentiveConfig?.frontend_helper_address, + swapAddress: bondingDays === 0 ? swapAddress : config?.frontend_helper, swapAssets: [tokenA, tokenB], senderAddress: address, client, diff --git a/components/Pages/Pools/ActionCTAs.tsx b/components/Pages/Pools/ActionCTAs.tsx index 89bb7e13..3ff56172 100644 --- a/components/Pages/Pools/ActionCTAs.tsx +++ b/components/Pages/Pools/ActionCTAs.tsx @@ -1,10 +1,14 @@ import { Button, HStack } from '@chakra-ui/react' import { useRouter } from 'next/router' +import { INCENTIVE_ENABLED_CHAIN_IDS } from 'constants/bonding_contract' +import { useMemo } from 'react' -export const ActionCTAs = ({ chainIdParam, pool }) => { +export const ActionCTAs = ({ chainIdParam, chainId, pool }) => { const router = useRouter() - - const isIncentivized = !!pool?.staking_address + const isIncentivized = useMemo( + () => INCENTIVE_ENABLED_CHAIN_IDS.includes(chainId), + [chainId] + ) const onIncentivizeClick = () => { router.push({ diff --git a/components/Pages/Pools/Pools.tsx b/components/Pages/Pools/Pools.tsx index e9db51fa..f1086f0d 100644 --- a/components/Pages/Pools/Pools.tsx +++ b/components/Pages/Pools/Pools.tsx @@ -59,7 +59,7 @@ const Pools = () => { }) ) const chains: any = useChains() - const currentChain = useMemo( + const currentChainPrefix = useMemo( () => chains.find((row) => row.chainId === chainId)?.bech32Config ?.bech32PrefixAccAddr, @@ -69,7 +69,7 @@ const Pools = () => { const incentivePoolInfos: IncentivePoolInfo[] = useIncentivePoolInfo( cosmWasmClient, pools, - currentChain + currentChainPrefix ) const calculateMyPosition = (pool) => { @@ -90,9 +90,9 @@ const Pools = () => { const initPools = async () => { setInitLoading(true) const poolsWithAprAnd24HrVolume: EnigmaPoolData[] = - currentChain === 'terra' + currentChainPrefix === 'terra' ? await getPairAprAndDailyVolumeTerra(pools) - : await getPairAprAndDailyVolume(pools, currentChain) + : await getPairAprAndDailyVolume(pools, currentChainPrefix) const _pools: PoolData[] = pools.map((pool: any) => { return { @@ -128,7 +128,13 @@ const Pools = () => { isUSDPool: isUSDPool, flows: flows, incentives: , - action: , + action: ( + + ), isSubqueryNetwork: false, } }) diff --git a/components/Wallet/ChainSelect/ChainList/ChainItem.tsx b/components/Wallet/ChainSelect/ChainList/ChainItem.tsx index d18951a5..e1854a07 100644 --- a/components/Wallet/ChainSelect/ChainList/ChainItem.tsx +++ b/components/Wallet/ChainSelect/ChainList/ChainItem.tsx @@ -37,7 +37,7 @@ function ChainItem({ }} onClick={() => { onChange(chain) - queryClient.invalidateQueries(['multipleTokenBalances', 'tokenBalance']) + queryClient.clear() onClose() }} > diff --git a/constants/bonding_contract.ts b/constants/bonding_contract.ts index d72e27f6..214257a8 100644 --- a/constants/bonding_contract.ts +++ b/constants/bonding_contract.ts @@ -1,4 +1,8 @@ -export const BONDING_ENABLED_CHAIN_IDS = ['narwhal-1', 'phoenix-1'] +export const BONDING_ENABLED_CHAIN_IDS = [ + 'narwhal-1', + 'phoenix-1', + 'chihuahua-1', +] export const INCENTIVE_ENABLED_CHAIN_IDS = ['narwhal-1', 'phoenix-1'] export const B_WHALE_TOKEN_SYMBOL = 'bWHALE' export const AMP_WHALE_TOKEN_SYMBOL = 'ampWHALE' diff --git a/hooks/useCosmwasmClient.ts b/hooks/useCosmwasmClient.ts index 10ce1d9f..f98192bd 100644 --- a/hooks/useCosmwasmClient.ts +++ b/hooks/useCosmwasmClient.ts @@ -5,23 +5,18 @@ import { useChains } from 'hooks/useChainInfo' export const useCosmwasmClient = (chainId?: string): CosmWasmClient => { const chainInfo = useChains() - const [clients, setClients] = useState({}) - - const getClients = async () => { - const clientList = {} - await Promise.all( - chainInfo.map(async (row) => { - clientList[row.chainId] = await CosmWasmClient.connect(row.rpc) - }) - ) - - if (Object.keys(clientList).length > 0) setClients(clientList) - } + const [client, setClient] = useState({}) useEffect(() => { - getClients() + const getClient = async () => { + const chain = chainInfo.find((row) => row.chainId === chainId) + const client = await CosmWasmClient.connect(chain?.rpc) + + if (!!client) setClient(client) + } + if (!!chainInfo && !!chainId) getClient() // eslint-disable-next-line react-hooks/exhaustive-deps - }, [chainInfo]) + }, [chainInfo, chainId]) - return clients[chainId] + return client } diff --git a/public/mainnet/chihuahua-1/config.json b/public/mainnet/chihuahua-1/config.json new file mode 100644 index 00000000..f2f9c658 --- /dev/null +++ b/public/mainnet/chihuahua-1/config.json @@ -0,0 +1,24 @@ +{ + "whale_lair": "chihuahua1dd7e5l7jf7yu23u8ehjw36aahsk7jjls9llcgm34szq0qemj6a9q8h30j7", + "incentive_factory": "chihuahua1wzde4vn8p8deskata2vy7z4cfvfzll0syjg8x659suhxnwqy7a8s6fhl4w", + "fee_distributor": "chihuahua15umr63cfrav8qk572x57rzjfcyqtfnret6rpfasju9ayeqmxrhjq5k0y8c", + "frontend_helper": "chihuahua1u28kmt7m6vkfjpxq0gz6vgud59ahwfd3vsewarjjtgdtrtlcvmhq79qws0", + "whale_base_token": { + "name": "WHALE", + "denom": "uwhale", + "decimals": 6 + }, + "lsd_token": { + "ampWHALE": { + "name": "ampWHALE", + "denom": "ibc/1ABC53B2BB5F76F5DE57F6A6640DAC100F5D078075768115FC3B8E83C54FD9FF", + "decimals": 6 + }, + "bWHALE": { + "name": "bWHALE", + "denom": "ibc/E452FABA9C51E85726BAB567EB582FEA1541B9D26543C6876996B61112DE72F7", + "decimals": 6 + } + } +} + diff --git a/public/mainnet/chihuahua-1/pools_list.json b/public/mainnet/chihuahua-1/pools_list.json index d3ef1e0a..ab0123e6 100644 --- a/public/mainnet/chihuahua-1/pools_list.json +++ b/public/mainnet/chihuahua-1/pools_list.json @@ -57,7 +57,7 @@ ], "lp_token": "chihuahua15hyh6lh6wehnezuhyxqvlgz8x3fm2fcslhx9kfdlehfltslu3u9qjm5lll", "swap_address": "chihuahua1zu6n9xtm6n7ksg4gawefg34n790jgdsfhqrrgjn9d9vc60k8q67sd96en9", - "staking_address": "", + "staking_address": "chihuahua1aw3zagmje4mv9vynxvxu6vh2nxnxy30alhv48cxj9wz7h6ywtrfsrflg4d", "rewards_tokens": [] }, { @@ -94,7 +94,7 @@ ], "lp_token": "chihuahua1w650rr57pasw4mxhlmawmp49ljje26k4xsa2qrfzjs8qeq9tvuys0pv7yc", "swap_address": "chihuahua1ncq4gg9c9du8u2jrp55dszxf00rr28m98q2n5sllwkmnsuxq4u6s2y2uu6", - "staking_address": "", + "staking_address": "chihuahua1gdnn2kkfgpvwuf0axeu5r4ry9lyfyzwl8zzywhqu9xxy0mnxr6lqyxxaa8", "rewards_tokens": [] }, { @@ -131,7 +131,7 @@ ], "lp_token": "chihuahua177qc0dufzlsytmlq7tx8s8mvjag062llr8ay53p3jnsm6y347qwqzzml96", "swap_address": "chihuahua1mqcyratr5xcmzr2t008skvh5zzfx8xuqgxnv6vvz5fqkas4vsgys3hzga0", - "staking_address": "", + "staking_address": "chihuahua1e3q4tzq8x8tehxtm9c4pt23jetamjl6f28ythh3j554wj5erq0ds5ye82t", "rewards_tokens": [] }, { @@ -168,7 +168,7 @@ ], "lp_token": "chihuahua1v5yqf0jcw3hl8uc8ucug8fr98n45krwfl0k5ktxrevqpu3c60f7qsjys7v", "swap_address": "chihuahua19du4llehge50k23pwwckj93lnvp9cyyer8ve9as663mz64nrhq9qn2gauk", - "staking_address": "", + "staking_address": "chihuahua1uqwzmywh29a8twj8vq2sectvmrrsrrhcujuanemgdf9fxkpkj8pscm7jcw", "rewards_tokens": [] }, { @@ -205,7 +205,7 @@ ], "lp_token": "chihuahua1ju5ecz9xcfly70g7fvh4yflh60d2uyf9g3hxl8xahra8szzy2jdsg6p63r", "swap_address": "chihuahua1py86y6946ed07g8v24thess2havjjgpg3uvjdu4v805czmge37hsvlt6qz", - "staking_address": "", + "staking_address": "chihuahua15lajuj879gh9aqyzc74hvgd0lyv2jmu7p24ssa9ght9as0y59n2s5sracw", "rewards_tokens": [] }, { @@ -242,7 +242,7 @@ ], "lp_token": "chihuahua1zcv45lr7gu7amg6plr6z0rmx29wts3d9gklm9g53klwj45qat84qm2cvld", "swap_address": "chihuahua1a6xwgvyvrmzgue6hectem3fwdzquny44a4y20a9wvlrtalhlsk9sryz5t9", - "staking_address": "", + "staking_address": "chihuahua1ec5ntzgj3mmw6enqhwcccvu9v620hm32jxknfnnncnfajuunvl0syc53yw", "rewards_tokens": [] }, { @@ -279,7 +279,7 @@ ], "lp_token": "chihuahua1wsxgq90w0sz7z5pzf828fdymtjfw9zutfxscpmjt8y024feaky5s5ugwvr", "swap_address": "chihuahua1ndkl0wln9maj9vlwzcv7fhzk6r27f8w3t44rsng0qg3y70jah8dqerwgy6", - "staking_address": "", + "staking_address": "chihuahua16tejyjn0e7kx7ukhjlu6cjq9wd2d2yea6w9c2uapzx8qd4wkpwqqkntpsr", "rewards_tokens": [] }, { @@ -317,7 +317,7 @@ ], "lp_token": "chihuahua1qj4qexx7flmwwv8fauzegshk3yh36f666kte72p9ede09q22n78s3vyrue", "swap_address": "chihuahua1pwdlm72srpfr6tdvfln0fagcczl93etj0mhh9w55czwg2je3k6pqdmqa3h", - "staking_address": "", + "staking_address": "chihuahua1339gxe6dkhc8nk37mn8m0nke34m0yhnttg2ydquku3detwruqk4swk2jf3", "rewards_tokens": [] }, { @@ -355,7 +355,7 @@ ], "lp_token": "chihuahua1hv3yeyapzwnpc0jm0zn49pnulm8pa70qflxzwm0jw4k2zreyujmq2cx65e", "swap_address": "chihuahua1l4735tn25cr0tjyjtdlcla020843hgjvtmvwrdtazfp9ut0a9arsd5w4ys", - "staking_address": "", + "staking_address": "chihuahua1z847h0qxxaq2khqd7muawea5n6slj0h3k5v2pgdrlc3xqkt08clsm4hp6d", "rewards_tokens": [] }, { @@ -394,7 +394,7 @@ ], "lp_token": "chihuahua1r2un7qsaqfmurm8ytcwqtylhrufhkkfwvrqdxa90c74ghgcpa9ps5tqn9n", "swap_address": "chihuahua1qekdpx5su9hhsswr0w4qq2szss0rwywl7y9gp4dawmp7jnm98mgss84zgv", - "staking_address": "", + "staking_address": "chihuahua145mca73sdpemqucqhrqq22qvp4hy06undghxtq48g6458ux9mm8s7ml92t", "rewards_tokens": [] }, { @@ -432,7 +432,7 @@ ], "lp_token": "chihuahua1e3ets9mwmffnzuuj03w53g3ch6jmazdwtpqhu0f2wc5a6z6yxaks6r3lrs", "swap_address": "chihuahua19x48cf5d5lm0z2dmqptgh4mhfglsy0nvvznra36zd3fpvjp277vqeyd2x6", - "staking_address": "", + "staking_address": "chihuahua1n0js6p3ea68hc825x2t6y569y7xkll0e2xqra52a223kchn66tusj6wrh4", "rewards_tokens": [] } ], diff --git a/public/mainnet/phoenix-1/bonding_config.json b/public/mainnet/phoenix-1/bonding_config.json deleted file mode 100644 index 47775045..00000000 --- a/public/mainnet/phoenix-1/bonding_config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "whale_lair_address": "terra1qa5a8fkynmthlrh9wsae4sqnuxdrespsls7c7acayqqvs5s63eksm53snj", - "fee_distributor_address": "terra1xm0yh8cv8rww6g87h3q0megt6ntxqzw6p6hgh5l4jrhed4fe7hnq9cvzm5", - "whale_base_token": { - "name": "WHALE", - "denom": "uwhale", - "decimals": 6 - }, - "lsd_token": { - "ampWHALE": { - "name": "ampWHALE", - "denom": "ibc/B3F639855EE7478750CC8F82072307ED6E131A8EFF20345E1D136B50C4E5EC36", - "decimals": 6 - }, - "bWHALE": { - "name": "bWHALE", - "denom": "ibc/517E13F14A1245D4DE8CF467ADD4DA0058974CDCC880FA6AE536DBCA1D16D84E", - "decimals": 6 - } - } -} - diff --git a/public/mainnet/phoenix-1/config.json b/public/mainnet/phoenix-1/config.json new file mode 100644 index 00000000..80a640cb --- /dev/null +++ b/public/mainnet/phoenix-1/config.json @@ -0,0 +1,24 @@ +{ + "whale_lair": "terra1qa5a8fkynmthlrh9wsae4sqnuxdrespsls7c7acayqqvs5s63eksm53snj", + "incentive_factory": "terra1qsfcuketm4slntdp92kg3ltnn57j7dzq3wg3yqjr8xhsnae6fn3sjmle9y", + "fee_distributor": "terra1xm0yh8cv8rww6g87h3q0megt6ntxqzw6p6hgh5l4jrhed4fe7hnq9cvzm5", + "frontend_helper": "terra1tslnzaadfhwdj67dzfvxhhy2agp0w69dt5uk5nfeaecevdqkh52sufhfrd", + "whale_base_token": { + "name": "WHALE", + "denom": "uwhale", + "decimals": 6 + }, + "lsd_token": { + "ampWHALE": { + "name": "ampWHALE", + "denom": "ibc/B3F639855EE7478750CC8F82072307ED6E131A8EFF20345E1D136B50C4E5EC36", + "decimals": 6 + }, + "bWHALE": { + "name": "bWHALE", + "denom": "ibc/517E13F14A1245D4DE8CF467ADD4DA0058974CDCC880FA6AE536DBCA1D16D84E", + "decimals": 6 + } + } +} + diff --git a/public/mainnet/phoenix-1/incentive_config.json b/public/mainnet/phoenix-1/incentive_config.json deleted file mode 100644 index 8e3891d6..00000000 --- a/public/mainnet/phoenix-1/incentive_config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "incentive_factory_address": "terra1qsfcuketm4slntdp92kg3ltnn57j7dzq3wg3yqjr8xhsnae6fn3sjmle9y", - "fee_distributor_address": "terra1xm0yh8cv8rww6g87h3q0megt6ntxqzw6p6hgh5l4jrhed4fe7hnq9cvzm5", - "frontend_helper_address": "terra1tslnzaadfhwdj67dzfvxhhy2agp0w69dt5uk5nfeaecevdqkh52sufhfrd" -} diff --git a/public/testnet/narwhal-1/bonding_config.json b/public/testnet/narwhal-1/bonding_config.json deleted file mode 100644 index c64e79c9..00000000 --- a/public/testnet/narwhal-1/bonding_config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "whale_lair_address": "migaloo1kr3e5mypfhj6mcfx8pac64npy9ugcmpwcndm36ew7cnkuu9ykmsqx0h9z4", - "fee_distributor_address": "migaloo1pl02gs047p84auvavwcawgfkehawv9vhgyndpyqyee796txelefq4np7kc", - "whale_base_token": { - "name": "WHALE", - "denom": "uwhale", - "decimals": 6 - }, - "lsd_token": { - "ampWHALE": { - "name": "ampWHALE", - "denom": "uwhale", - "decimals": 6 - }, - "bWHALE": { - "name": "bWHALE", - "denom": "ibc", - "decimals": 6 - } - } -} - diff --git a/public/testnet/narwhal-1/config.json b/public/testnet/narwhal-1/config.json new file mode 100644 index 00000000..9f19c5ed --- /dev/null +++ b/public/testnet/narwhal-1/config.json @@ -0,0 +1,24 @@ +{ + "whale_lair": "migaloo1kr3e5mypfhj6mcfx8pac64npy9ugcmpwcndm36ew7cnkuu9ykmsqx0h9z4", + "fee_distributor": "migaloo1pl02gs047p84auvavwcawgfkehawv9vhgyndpyqyee796txelefq4np7kc", + "incentive_factory": "migaloo1wqsyztz9qw2ert8n2zypq5pp5evyqtrj7pzagrj40rwkypgghm3qeqj2jg", + "frontend_helper": "migaloo1ldn4f4ycnq9sd9uncfemqqr58a6fpv8924wxs4w9zf6uz8hql2wsf2wwes", + "whale_base_token": { + "name": "WHALE", + "denom": "uwhale", + "decimals": 6 + }, + "lsd_token": { + "ampWHALE": { + "name": "ampWHALE", + "denom": "uwhale", + "decimals": 6 + }, + "bWHALE": { + "name": "bWHALE", + "denom": "ibc", + "decimals": 6 + } + } +} + diff --git a/public/testnet/narwhal-1/incentive_config.json b/public/testnet/narwhal-1/incentive_config.json deleted file mode 100644 index adfd4ab9..00000000 --- a/public/testnet/narwhal-1/incentive_config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "incentive_factory_address": "migaloo1wqsyztz9qw2ert8n2zypq5pp5evyqtrj7pzagrj40rwkypgghm3qeqj2jg", - "fee_distributor_address": "migaloo1l9lnd2qrtkejhj30lkjwfknkvtswgf7hrtzfwkse760wnajt78mq9skwjn" -} diff --git a/util/wallet-adapters/terraStationWallet.ts b/util/wallet-adapters/terraStationWallet.ts index 4bca91b9..34e30a7a 100644 --- a/util/wallet-adapters/terraStationWallet.ts +++ b/util/wallet-adapters/terraStationWallet.ts @@ -87,7 +87,7 @@ export class TerraStationWallet implements Wallet { post( senderAddress: string, msgs: EncodeObject[], - memo: string | undefined, + memo: string | undefined ): Promise { return this.client .post({