From 66a60fa6d8e2449850e49c81ccf51fc9c15cf605 Mon Sep 17 00:00:00 2001 From: Robert Pirtle Date: Wed, 21 Dec 2022 11:51:14 -0800 Subject: [PATCH] seed dev-wallet power on internal testnet (#1442) the seed script will issue & delegate enough KAVA to the genesis validators to have enough power to pass gov proposals by itself. --- .github/scripts/seed-internal-testnet.sh | 16 +++++++++++++++- .github/workflows/cd-seed-chain.yml | 6 ++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/scripts/seed-internal-testnet.sh b/.github/scripts/seed-internal-testnet.sh index aadfbf86..c30d1ff3 100755 --- a/.github/scripts/seed-internal-testnet.sh +++ b/.github/scripts/seed-internal-testnet.sh @@ -19,7 +19,7 @@ echo "${DEV_WALLET_MNEMONIC}" | kava keys add --recover dev-wallet echo "sweet ocean blush coil mobile ten floor sample nuclear power legend where place swamp young marble grit observe enforce lake blossom lesson upon plug" | kava keys add --recover --eth dev-erc20-deployer-wallet # fund evm-contract-deployer account (using issuance) -yes y | kava tx issuance issue 200000000ukava kava1van3znl6597xgwwh46jgquutnqkwvwszjg04fz --from dev-wallet --gas-prices 0.5ukava +kava tx issuance issue 200000000ukava kava1van3znl6597xgwwh46jgquutnqkwvwszjg04fz --from dev-wallet --gas-prices 0.5ukava -y # deploy and fund USDC ERC20 contract USD_CONTRACT_DEPLOY=$(npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" deploy-erc20 "USD Coin" USDC 6) @@ -45,3 +45,17 @@ npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" mint-erc20 "$USDT_CONTRAC DAI_CONTRACT_DEPLOY=$(npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" deploy-erc20 "DAI" DAI 18) DAI_CONTRACT_ADDRESS=${DAI_CONTRACT_DEPLOY: -42} npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" mint-erc20 "$DAI_CONTRACT_ADDRESS" 0x6767114FFAA17C6439D7AEA480738B982CE63A02 1000000000000 + +# give dev-wallet enough delegation power to pass proposals by itself +# enumerate all genesis validators +GENTX_VALIDATORS=($(curl -s "${CHAIN_API_URL}" | jq -r '.result.genesis.app_state.genutil.gen_txs[].body.messages[0].validator_address')) + +# issue 300KAVA to delegate to each validator +kava tx issuance issue "$((${#GENTX_VALIDATORS[@]}*300000000))"ukava kava1vlpsrmdyuywvaqrv7rx6xga224sqfwz3fyfhwq \ + --from dev-wallet --gas-prices 0.5ukava -y + +# delegate 300KAVA to each validator +for validator in "${GENTX_VALIDATORS[@]}" +do + kava tx staking delegate "${validator}" 300000000ukava --from dev-wallet --gas-prices 0.5ukava -y +done diff --git a/.github/workflows/cd-seed-chain.yml b/.github/workflows/cd-seed-chain.yml index 5c5fb4ce..e7048f84 100644 --- a/.github/workflows/cd-seed-chain.yml +++ b/.github/workflows/cd-seed-chain.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.18' + go-version: "1.18" check-latest: true cache: true - name: build kava binary @@ -61,8 +61,10 @@ jobs: - name: compile default erc20 contracts run: make compile-contracts working-directory: kava-bridge + - name: install jq + run: sudo apt-get install -y jq - name: run seed scripts - run: bash ${GITHUB_WORKSPACE}/.github/scripts/${SEED_SCRIPT_FILENAME} + run: bash ${GITHUB_WORKSPACE}/.github/scripts/${SEED_SCRIPT_FILENAME} working-directory: kava-bridge/contract env: CHAIN_API_URL: ${{ inputs.chain-api-url }}