Use different balances for STAKE and COSM
This commit is contained in:
parent
bbee44da54
commit
9170eb5ae1
@ -29,15 +29,15 @@ describe("StargateClient", () => {
|
||||
pendingWithoutSimapp();
|
||||
const client = await StargateClient.connect(simapp.tendermintUrl);
|
||||
|
||||
const response1 = await client.getBalance(unused.address, "ucosm");
|
||||
const response1 = await client.getBalance(unused.address, simapp.denomFee);
|
||||
expect(response1).toEqual({
|
||||
amount: "1000000000",
|
||||
denom: "ucosm",
|
||||
amount: unused.balanceFee,
|
||||
denom: simapp.denomFee,
|
||||
});
|
||||
const response2 = await client.getBalance(unused.address, "ustake");
|
||||
const response2 = await client.getBalance(unused.address, simapp.denomStaking);
|
||||
expect(response2).toEqual({
|
||||
amount: "1000000000",
|
||||
denom: "ustake",
|
||||
amount: unused.balanceStaking,
|
||||
denom: simapp.denomStaking,
|
||||
});
|
||||
|
||||
client.disconnect();
|
||||
|
||||
@ -7,6 +7,8 @@ export function pendingWithoutSimapp(): void {
|
||||
export const simapp = {
|
||||
tendermintUrl: "localhost:26657",
|
||||
chainId: "simd-testing",
|
||||
denomStaking: "ustake",
|
||||
denomFee: "ucosm",
|
||||
};
|
||||
|
||||
/** Unused account */
|
||||
@ -18,4 +20,6 @@ export const unused = {
|
||||
address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u",
|
||||
accountNumber: 16,
|
||||
sequence: 0,
|
||||
balanceStaking: "10000000", // 10 STAKE
|
||||
balanceFee: "1000000000", // 1000 COSM
|
||||
};
|
||||
|
||||
@ -3,11 +3,16 @@ set -o errexit -o nounset
|
||||
command -v shellcheck > /dev/null && shellcheck "$0"
|
||||
|
||||
PASSWORD=${PASSWORD:-1234567890}
|
||||
STAKE=${STAKE_TOKEN:-ustake}
|
||||
FEE=${FEE_TOKEN:-ucosm}
|
||||
CHAIN_ID=${CHAIN_ID:-simd-testing}
|
||||
MONIKER=${MONIKER:-simd-moniker}
|
||||
|
||||
# The staking and the fee tokens. The supply of the staking token is low compared to the fee token (factor 100).
|
||||
STAKE=${STAKE_TOKEN:-ustake}
|
||||
FEE=${FEE_TOKEN:-ucosm}
|
||||
|
||||
# 10 STAKE and 1000 COSM
|
||||
START_BALANCE="10000000$STAKE,1000000000$FEE"
|
||||
|
||||
echo "Creating genesis ..."
|
||||
simd init --chain-id "$CHAIN_ID" "$MONIKER"
|
||||
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this
|
||||
@ -18,15 +23,16 @@ if ! simd keys show validator 2> /dev/null; then
|
||||
(echo "$PASSWORD"; echo "$PASSWORD") | simd keys add validator
|
||||
fi
|
||||
# hardcode the validator account for this instance
|
||||
echo "$PASSWORD" | simd add-genesis-account validator "1000000000$STAKE,1000000000$FEE"
|
||||
echo "$PASSWORD" | simd add-genesis-account validator "$START_BALANCE"
|
||||
|
||||
echo "Setting up accounts ..."
|
||||
# (optionally) add a few more genesis accounts
|
||||
for addr in "$@"; do
|
||||
echo "$addr"
|
||||
simd add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE"
|
||||
simd add-genesis-account "$addr" "$START_BALANCE"
|
||||
done
|
||||
|
||||
echo "Creating genesis tx ..."
|
||||
(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | simd gentx validator --offline --amount "250000000$STAKE" --chain-id "$CHAIN_ID" --moniker="$MONIKER"
|
||||
SELF_DELEGATION="3000000$STAKE" # 3 STAKE (leads to a voting power of 3)
|
||||
(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | simd gentx validator --offline --amount "$SELF_DELEGATION" --chain-id "$CHAIN_ID" --moniker="$MONIKER"
|
||||
simd collect-gentxs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user