Skip to content

Commit

Permalink
fix: add --gas-prices flag to bootstrap shell scripts (dymensionxyz…
Browse files Browse the repository at this point in the history
…#530)

Co-authored-by: Artemijs Pavlovs <[email protected]>
  • Loading branch information
artemijspavlovs authored Feb 4, 2024
1 parent 9c1be1f commit a818e6c
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 61 deletions.
63 changes: 35 additions & 28 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,37 +60,42 @@ export PATH=$PATH:$(go env GOPATH)/bin

- Using the setup script:

This method is preferred as it preconfigured to support [running rollapps locally](https://github.com/dymensionxyz/roller)
This method is preferred as it preconfigured to support [running rollapps locally](https://github.com/dymensionxyz/roller)

```sh
bash scripts/setup_local.sh
```
```sh
bash scripts/setup_local.sh
```

- Manually:

First, set the following environment variables:

```sh
export CHAIN_ID="dymension_100-1"
export KEY_NAME="local-user"
export MONIKER_NAME="local"
```

Second, create genesis and init dymension chain:
```sh
dymd init "$MONIKER_NAME" --chain-id "$CHAIN_ID"
```
Third, set parameters to ensure denom is udym:
```sh
bash scripts/set_params.sh
```
Then, add genesis account and provide token to the account:
```sh
dymd keys add "$KEY_NAME" --keyring-backend test
dymd add-genesis-account "$(dymd keys show "$KEY_NAME" -a --keyring-backend test)" 1000dym
dymd gentx "$KEY_NAME" 670dym --chain-id "$CHAIN_ID" --keyring-backend test
dymd collect-gentxs
```
First, set the following environment variables:

```sh
export CHAIN_ID="dymension_100-1"
export KEY_NAME="local-user"
export MONIKER_NAME="local"
```

Second, create genesis and init dymension chain:

```sh
dymd init "$MONIKER_NAME" --chain-id "$CHAIN_ID"
```

Third, set parameters to ensure denom is udym:

```sh
bash scripts/set_params.sh
```

Then, add genesis account and provide token to the account:

```sh
dymd keys add "$KEY_NAME" --keyring-backend test
dymd add-genesis-account "$(dymd keys show "$KEY_NAME" -a --keyring-backend test)" 1000dym
dymd gentx "$KEY_NAME" 670dym --chain-id "$CHAIN_ID" --keyring-backend test
dymd collect-gentxs
```

## Running the Chain

Expand Down Expand Up @@ -144,11 +149,13 @@ dymd q lockup module-balance

Every minute a share of the rewards will be distributed!


validate with:

```sh
dymd q incentives active-gauges

# alternatively, watch the outpup - you will see the "amount" change every minute
# watch -n1 -d "dymd q incentives active-gauges --output json | jq '.data[] | { "id": .id, "coins": .coins } '"
```

If you have any issues please contact us on [discord](http://discord.gg/dymension) in the Developer section. We are here for you!
20 changes: 9 additions & 11 deletions scripts/incentives/fund_incentives.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
#!/bin/bash

# fund streamer
dymd tx bank send local-user dym1ysjlrjcankjpmpxxzk27mvzhv25e266r80p5pv 300000dym --keyring-backend test -b block -y

dymd tx bank send local-user \
dym1ysjlrjcankjpmpxxzk27mvzhv25e266r80p5pv \
300000dym --keyring-backend test -b block -y --gas-prices 100000000adym

# create new gauges for lockdrop
echo "Creating gauges for lockdrop of uatom"
dymd tx incentives create-gauge uatom 30dym --duration="60s" --perpetual --from local-user -b block --gas auto -y

dymd tx incentives create-gauge uatom 30dym --duration="60s" --perpetual --from local-user -b block --gas auto -y --gas-prices 100000000adym

# create first stream for the LP holders
echo "Gov proposal for creating new stream with LP1 and LP2 as incentives targets"
dymd tx gov submit-legacy-proposal create-stream-proposal 1,2 40,60 200000dym --epoch-identifier minute --from local-user -b block --title sfasfas --description ddasda --deposit 1dym -y
dymd tx gov submit-legacy-proposal create-stream-proposal 1,2 40,60 20000dym --epoch-identifier minute --from local-user -b block --title sfasfas --description ddasda --deposit 11dym -y --gas auto --gas-prices 100000000adym
last_proposal_id=$(dymd q gov proposals -o json | jq '.proposals | map(.id | tonumber) | max')
dymd tx gov vote "$last_proposal_id" yes --from local-user -b block -y

dymd tx gov vote "$last_proposal_id" yes --from local-user -b block -y --gas-prices 100000000adym

# create second stream for the Lockdrop
echo "Gov proposal for creating new stream for lockdrop"
dymd tx gov submit-legacy-proposal create-stream-proposal 3 100 100000dym --epoch-identifier minute --from local-user -b block --title sfasfas --description ddasda --deposit 1dym -y
dymd tx gov submit-legacy-proposal create-stream-proposal 3 100 10000dym --epoch-identifier minute --from local-user -b block --title sfasfas --description ddasda --deposit 1dym -y --gas auto --gas-prices 100000000adym
last_proposal_id=$(dymd q gov proposals -o json | jq '.proposals | map(.id | tonumber) | max')
dymd tx gov vote "$last_proposal_id" yes --from local-user -b block -y


dymd tx gov vote "$last_proposal_id" yes --from local-user -b block -y --gas-prices 100000000adym
~
8 changes: 4 additions & 4 deletions scripts/incentives/lockup_bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh

echo "locking LP1 tokens for 2 weeks"
dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="60s" --from pools --keyring-backend=test -b block -y
dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="60s" --from pools --keyring-backend=test -b block -y --gas-prices 100000000adym

echo "locking uatom tokens for 1h"
dymd tx lockup lock-tokens 500000000uatom --duration="3600s" --from user --keyring-backend=test -b block -y
dymd tx lockup lock-tokens 500000000uatom --duration="3600s" --from user --keyring-backend=test -b block -y --gas-prices 100000000adym

echo "locking dym tokens for 1 day"
dymd tx lockup lock-tokens 100dym --duration="24h" --from user --keyring-backend=test -b block -y
dymd tx lockup lock-tokens 100dym --duration="24h" --from user --keyring-backend=test -b block -y --gas-prices 100000000adym
echo "unlocking dym tokens"
dymd tx lockup begin-unlock-by-id 2 --from user --keyring-backend=test -b block -y
dymd tx lockup begin-unlock-by-id 2 --from user --keyring-backend=test -b block -y --gas-prices 100000000adym
12 changes: 6 additions & 6 deletions scripts/pools/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ create_asset_pool "$(dirname "$0")/nativeDenomPoolB.json"
echo "====================="
streamer_addr=$(dymd q auth module-account streamer -o json | jq '.account.base_account.address' | tr -d '"')
echo "Sending 300000dym to $streamer_addr"
dymd tx bank send local-user $streamer_addr 300000dym --keyring-backend test -b block -y --fees 1dym
dymd tx bank send local-user $streamer_addr 300000dym --keyring-backend test -b block -y --fees 1dym --gas-prices 100000000adym

# lock LP tokens
echo "====================="
echo "Locking LP tokens"
echo "locking LP1 tokens for 1 day"
dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="24h" --from pools --keyring-backend=test -b block -y --fees 1dym
dymd tx lockup lock-tokens 50000000000000000000gamm/pool/1 --duration="24h" --from pools --keyring-backend=test -b block -y --fees 1dym --gas-prices 100000000adym
echo "locking LP2 tokens for 1 minute"
dymd tx lockup lock-tokens 50000000000000000000gamm/pool/2 --duration="1m" --from pools --keyring-backend=test -b block -y --fees 1dym

dymd tx lockup lock-tokens 50000000000000000000gamm/pool/2 --duration="1m" --from pools --keyring-backend=test -b block -y --fees 1dym --gas-prices 100000000adym

# create new stream
echo "====================="
echo "Gov proposal for creating new stream with LP1 and LP2 as incentives targets"
dymd tx gov submit-legacy-proposal create-stream-proposal 1,2 40,60 10000dym --epoch-identifier minute --from local-user -b block --title sfasfas --description ddasda --deposit 1dym -y --fees 1dym --gas auto
dymd tx gov submit-legacy-proposal create-stream-proposal 1,2 40,60 10000dym --epoch-identifier minute --from local-user -b block --title sfasfas --description ddasda --deposit 1dym -y --fees 1dym --gas auto --gas-prices 100000000adym

last_proposal_id=$(dymd q gov proposals -o json | jq '.proposals | map(.id | tonumber) | max')
dymd tx gov vote "$last_proposal_id" yes --from local-user -b block -y --fees 1dym
dymd tx gov vote "$last_proposal_id" yes --from local-user -b block -y --fees 1dym --gas-prices 100000000adym
16 changes: 8 additions & 8 deletions scripts/pools/pools_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@

# Define the functions using the new function
create_asset_pool() {
dymd tx gamm create-pool --pool-file=$1 --from pools --keyring-backend=test -b block --gas auto --yes
dymd tx gamm create-pool --pool-file=$1 --from pools --keyring-backend=test -b block --gas auto --yes --gas-prices 100000000adym
}


join_to_pool() {
dymd tx gamm join-pool --pool-id 1 --share-amount-out 20000000000000000000 --max-amounts-in "" --from user --keyring-backend test -b block
dymd tx gamm join-swap-extern-amount-in 100dym 20000000000000000000 --pool-id 1 --from user --keyring-backend test -b block
dymd tx gamm join-pool --pool-id 1 --share-amount-out 20000000000000000000 --max-amounts-in "" --from user --keyring-backend test -b block --gas-prices 100000000adym
dymd tx gamm join-swap-extern-amount-in 100dym 20000000000000000000 --pool-id 1 --from user --keyring-backend test -b block --gas-prices 100000000adym
}

exit_pool() {
dymd tx gamm exit-pool --pool-id=$1 --shares=$2 --from pools --keyring-backend=test -b block --gas auto --yes
dymd tx gamm exit-pool --pool-id=$1 --shares=$2 --from pools --keyring-backend=test -b block --gas auto --yes --gas-prices 100000000adym
}

swap_tokens() {
# dymd tx gamm swap --exact-amount-in=$1 --exact-amount-out=$2 --from pools --keyring-backend=test -b block --gas auto --yes
dymd tx gamm swap-exact-amount-in 50adym 50000000 --swap-route-pool-ids 1 --swap-route-denoms uatom --from user --keyring-backend test -b block
dymd tx gamm swap-exact-amount-in 50adym 50000000 --swap-route-pool-ids 1 --swap-route-denoms uatom --from user --keyring-backend test -b block --gas-prices 100000000adym
}

multi_hop_swap() {
dymd tx gamm swap-exact-amount-in 50000000uatom 20000000 --swap-route-pool-ids 1,2 --swap-route-denoms adym,uusd --from user --keyring-backend test -b block
dymd tx gamm swap-exact-amount-in 50000000uatom 20000000 --swap-route-pool-ids 1,2 --swap-route-denoms adym,uusd --from user --keyring-backend test -b block --gas-prices 100000000adym
}

echo "Creating pools"
echo "Creating adym/uatom pool"
create_asset_pool "$(dirname "$0")/nativeDenomPoolA.json"
echo "Creating adym/uusd pool"
create_asset_pool "$(dirname "$0")/nativeDenomPoolB.json"
create_asset_pool "$(dirname "$0")/nativeDenomPoolB.json"

6 changes: 2 additions & 4 deletions scripts/setup_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ CHAIN_ID=${CHAIN_ID:-"dymension_100-1"}
MONIKER_NAME=${MONIKER_NAME:-"local"}
KEY_NAME=${KEY_NAME:-"local-user"}


# Setting non-default ports to avoid port conflicts when running local rollapp
SETTLEMENT_ADDR=${SETTLEMENT_ADDR:-"0.0.0.0:36657"}
P2P_ADDRESS=${P2P_ADDRESS:-"0.0.0.0:36656"}
Expand Down Expand Up @@ -94,7 +93,6 @@ if [ ! "$answer" != "${answer#[Nn]}" ] ;then
enable_monitoring
fi


echo "Initialize AMM accounts? (Y/n) "
read -r answer
if [ ! "$answer" != "${answer#[Nn]}" ] ;then
Expand All @@ -107,9 +105,9 @@ if [ ! "$answer" != "${answer#[Nn]}" ] ;then
dymd add-genesis-account $(dymd keys show user --keyring-backend test -a) 1000000000000000000000adym,10000000000uatom
fi


dymd keys add "$KEY_NAME" --keyring-backend test
dymd add-genesis-account "$(dymd keys show "$KEY_NAME" -a --keyring-backend test)" "$TOKEN_AMOUNT"

dymd gentx "$KEY_NAME" "$STAKING_AMOUNT" --chain-id "$CHAIN_ID" --keyring-backend test
dymd collect-gentxs
dymd collect-gentxs

0 comments on commit a818e6c

Please sign in to comment.