chore(governance): add hardcoded token vesting contract address (#3352)

This commit is contained in:
Matthew Russell 2023-04-03 14:17:32 -07:00 committed by GitHub
parent 18f1c0014c
commit 861760b4f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 13 deletions

View File

@ -12,6 +12,7 @@ const TRUTHY = ['1', 'true'];
interface VegaContracts { interface VegaContracts {
claimAddress: string; claimAddress: string;
lockedAddress: string; lockedAddress: string;
tokenVestingAddress?: string;
} }
const customClaimAddress = process.env['NX_CUSTOM_CLAIM_ADDRESS'] as string; const customClaimAddress = process.env['NX_CUSTOM_CLAIM_ADDRESS'] as string;
@ -43,6 +44,9 @@ export const ContractAddresses: {
VALIDATOR_TESTNET: { VALIDATOR_TESTNET: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env 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: { MAINNET: {
claimAddress: '0x0ee1fb382caf98e86e97e51f9f42f8b4654020f3', claimAddress: '0x0ee1fb382caf98e86e97e51f9f42f8b4654020f3',

View File

@ -49,6 +49,13 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => {
signer = provider.getSigner(); 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) { if (provider && config) {
const staking = new StakingBridge( const staking = new StakingBridge(
config.staking_bridge_contract.address, config.staking_bridge_contract.address,
@ -63,7 +70,7 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => {
signer || provider signer || provider
), ),
vesting: new TokenVesting( vesting: new TokenVesting(
config.token_vesting_contract.address, tokenVestingAddress,
signer || provider signer || provider
), ),
claim: new Claim(ENV.addresses.claimAddress, signer || provider), claim: new Claim(ENV.addresses.claimAddress, signer || provider),

View File

@ -14,6 +14,7 @@ import { TokenDetailsCirculating } from './token-details-circulating';
import { SplashLoader } from '../../../components/splash-loader'; import { SplashLoader } from '../../../components/splash-loader';
import { useEthereumConfig } from '@vegaprotocol/web3'; import { useEthereumConfig } from '@vegaprotocol/web3';
import { useContracts } from '../../../contexts/contracts/contracts-context'; import { useContracts } from '../../../contexts/contracts/contracts-context';
import { ENV } from '../../../config';
export const TokenDetails = ({ export const TokenDetails = ({
totalSupply, totalSupply,
@ -49,6 +50,9 @@ export const TokenDetails = ({
); );
} }
const tokenVestingContractAddress =
config.token_vesting_contract?.address || ENV.addresses.tokenVestingAddress;
return ( return (
<div className="token-details"> <div className="token-details">
<RoundedWrapper> <RoundedWrapper>
@ -65,18 +69,20 @@ export const TokenDetails = ({
{token.address} {token.address}
</Link> </Link>
</KeyValueTableRow> </KeyValueTableRow>
<KeyValueTableRow> {tokenVestingContractAddress && (
{t('Vesting contract').toUpperCase()} <KeyValueTableRow>
<Link {t('Vesting contract').toUpperCase()}
data-testid="token-contract" <Link
title={t('View on Etherscan (opens in a new tab)')} data-testid="token-contract"
className="font-mono text-white text-right" title={t('View on Etherscan (opens in a new tab)')}
href={`${ETHERSCAN_URL}/address/${config.token_vesting_contract.address}`} className="font-mono text-white text-right"
target="_blank" href={`${ETHERSCAN_URL}/address/${tokenVestingContractAddress}`}
> target="_blank"
{config.token_vesting_contract.address} >
</Link> {tokenVestingContractAddress}
</KeyValueTableRow> </Link>
</KeyValueTableRow>
)}
<KeyValueTableRow> <KeyValueTableRow>
{t('Total supply').toUpperCase()} {t('Total supply').toUpperCase()}
<span className="font-mono" data-testid="total-supply"> <span className="font-mono" data-testid="total-supply">