diff --git a/apps/governance/src/config/env.ts b/apps/governance/src/config/env.ts index af727ed1a..5fdbeb9d6 100644 --- a/apps/governance/src/config/env.ts +++ b/apps/governance/src/config/env.ts @@ -12,6 +12,7 @@ const TRUTHY = ['1', 'true']; interface VegaContracts { claimAddress: string; lockedAddress: string; + tokenVestingAddress?: string; } const customClaimAddress = process.env['NX_CUSTOM_CLAIM_ADDRESS'] as string; @@ -43,6 +44,9 @@ export const ContractAddresses: { VALIDATOR_TESTNET: { claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error lockedAddress: '0x0', // TODO not deployed to this env + // This is a fallback contract address for the validator testnet network which does not + // have a vesting contract address set and is therefore not in the ethereum config + tokenVestingAddress: '0xadFcb7f93a24F8743a8e548d74d2ecB373c92866', }, MAINNET: { claimAddress: '0x0ee1fb382caf98e86e97e51f9f42f8b4654020f3', diff --git a/apps/governance/src/contexts/contracts/contracts-provider.tsx b/apps/governance/src/contexts/contracts/contracts-provider.tsx index 4e2eb46a6..7737a4248 100644 --- a/apps/governance/src/contexts/contracts/contracts-provider.tsx +++ b/apps/governance/src/contexts/contracts/contracts-provider.tsx @@ -49,6 +49,13 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => { signer = provider.getSigner(); } + const tokenVestingAddress = + config.token_vesting_contract?.address || + ENV.addresses.tokenVestingAddress; + if (!tokenVestingAddress) { + throw new Error('No token vesting address found'); + } + if (provider && config) { const staking = new StakingBridge( config.staking_bridge_contract.address, @@ -63,7 +70,7 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => { signer || provider ), vesting: new TokenVesting( - config.token_vesting_contract.address, + tokenVestingAddress, signer || provider ), claim: new Claim(ENV.addresses.claimAddress, signer || provider), diff --git a/apps/governance/src/routes/token/token-details/token-details.tsx b/apps/governance/src/routes/token/token-details/token-details.tsx index 2170e1115..7472c48e1 100644 --- a/apps/governance/src/routes/token/token-details/token-details.tsx +++ b/apps/governance/src/routes/token/token-details/token-details.tsx @@ -14,6 +14,7 @@ import { TokenDetailsCirculating } from './token-details-circulating'; import { SplashLoader } from '../../../components/splash-loader'; import { useEthereumConfig } from '@vegaprotocol/web3'; import { useContracts } from '../../../contexts/contracts/contracts-context'; +import { ENV } from '../../../config'; export const TokenDetails = ({ totalSupply, @@ -49,6 +50,9 @@ export const TokenDetails = ({ ); } + const tokenVestingContractAddress = + config.token_vesting_contract?.address || ENV.addresses.tokenVestingAddress; + return (
@@ -65,18 +69,20 @@ export const TokenDetails = ({ {token.address} - - {t('Vesting contract').toUpperCase()} - - {config.token_vesting_contract.address} - - + {tokenVestingContractAddress && ( + + {t('Vesting contract').toUpperCase()} + + {tokenVestingContractAddress} + + + )} {t('Total supply').toUpperCase()}