Skip to content

Commit

Permalink
feat: community pool spend for 0.47.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kienn6034 committed Jan 25, 2024
1 parent 473898b commit 9fda52b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 21 deletions.
30 changes: 22 additions & 8 deletions scripts/create-community-pool-spend-msg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BINARY=migalood
BINARY=${1:-migalood}
CONTINUE=${CONTINUE:-"false"}
HOME_DIR=$(pwd)/mytestnet
SCRIPTS_FOLDER=$(pwd)/scripts
Expand All @@ -17,28 +17,42 @@ COMMUNITY_POOL_AMOUNT=1000000000
$BINARY tx distribution fund-community-pool $COMMUNITY_POOL_AMOUNT$DENOM --from $KEY --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME_DIR -y

## Show receipient balance before proposal.
test1_addr=$($BINARY keys show $KEY1 -a --keyring-backend $KEYRING --home $HOME_DIR)
recipient=$($BINARY keys show $KEY2 -a --keyring-backend $KEYRING --home $HOME_DIR)

PRE_AMOUNT=$($BINARY query bank balances $recipient --chain-id $CHAIN_ID --home $HOME_DIR -o json | jq -r ".balances[0].amount")
echo "Recipient: $recipient"
echo "Pre receipient amount: $PRE_AMOUNT"

## Test1 Create a community pool spend message, receipient is test2
AMOUNT_REQUEST=$COMMUNITY_POOL_AMOUNT$DENOM

AMOUNT_REQUEST=$COMMUNITY_POOL_AMOUNT
proposal_file=$SCRIPTS_FOLDER/proposal.json
cat << EOF > $proposal_file
{
"title": "Community Spend: Chihuahua ... ",
"description": "This proposal is to request funds for ...",
"recipient": "$recipient",
"amount": "$AMOUNT_REQUEST",
"title": "Community Spend: Chihuhua...",
"metadata": "ipfs link: ..",
"summary": "This proposal is to request funds for ...",
"messages": [
{
"@type": "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
"authority": "$test1_addr",
"recipient": "$recipient",
"amount": [
{
"denom": "$DENOM",
"amount": "$AMOUNT_REQUEST"
}
]
}
],
"deposit": "25000000000$DENOM"
}
EOF


echo "Proposal file: $proposal_file"
sleep 3
$BINARY tx gov submit-legacy-proposal community-pool-spend $proposal_file --from test1 --keyring-backend test --chain-id $CHAIN_ID --home $HOME_DIR -y
$BINARY tx gov submit-proposal $proposal_file --from test1 --keyring-backend test --chain-id $CHAIN_ID --home $HOME_DIR -y


## Validator vote yes
Expand Down
16 changes: 8 additions & 8 deletions scripts/local_node.sh → scripts/local-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ "$CONTINUE" == "true" ]; then
fi

rm -rf mytestnet
pkill migalood
pkill $BINARY

# check DENOM is set. If not, set to uwhale
DENOM=${2:-uwhale}
Expand Down Expand Up @@ -57,9 +57,9 @@ $BINARY keys add $KEY1 --keyring-backend $KEYRING --home $HOME_DIR
$BINARY keys add $KEY2 --keyring-backend $KEYRING --home $HOME_DIR

# Allocate genesis accounts (cosmos formatted addresses)
$BINARY add-genesis-account $KEY "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
$BINARY add-genesis-account $KEY1 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
$BINARY add-genesis-account $KEY2 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
$BINARY genesis add-genesis-account $KEY "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
$BINARY genesis add-genesis-account $KEY1 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
$BINARY genesis add-genesis-account $KEY2 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR

update_test_genesis '.app_state["gov"]["voting_params"]["voting_period"]="20s"'
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"'
Expand All @@ -73,12 +73,12 @@ $SED_BINARY -i 's/swagger = false/swagger = true/' $HOME_DIR/config/app.toml
$SED_BINARY -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' $HOME_DIR/config/app.toml

# Sign genesis transaction
$BINARY gentx $KEY "1000000${DENOM}" --commission-rate=$COMMISSION_RATE --commission-max-rate=$COMMISSION_MAX_RATE --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME_DIR
$BINARY genesis gentx $KEY "1000000${DENOM}" --commission-rate=$COMMISSION_RATE --commission-max-rate=$COMMISSION_MAX_RATE --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME_DIR

# Collect genesis tx
$BINARY collect-gentxs --home $HOME_DIR
$BINARY genesis collect-gentxs --home $HOME_DIR

# Run this to ensure everything worked and that the genesis file is setup correctly
$BINARY validate-genesis --home $HOME_DIR
$BINARY genesis validate-genesis --home $HOME_DIR

$BINARY start --home $HOME_DIR
$BINARY start --minimum-gas-prices="0$DENOM" --home $HOME_DIR
22 changes: 17 additions & 5 deletions scripts/proposal.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"title": "Community Spend: Chihuahua ... ",
"description": "This proposal is to request funds for ...",
"recipient": "migaloo1zz74g4e8mf75d7fjx8ct78k3k7vnrdc98tvy3z",
"amount": "1000000000uwhale",
"deposit": "25000000000uwhale"
"title": "Community Spend: Chihuhua...",
"metadata": "ipfs link: ..",
"summary": "This proposal is to request funds for ...",
"messages": [
{
"@type": "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
"authority": "chihuahua1xcgxj7rt0xjhapvw5jcktl7ra8pjvrnjl9whkf",
"recipient": "chihuahua1pr9hw78fryxcjk7z6aev3pwe5lfmza6uzsx57q",
"amount": [
{
"denom": "uchihuahua",
"amount": "1000000000"
}
]
}
],
"deposit": "25000000000uchihuahua"
}

0 comments on commit 9fda52b

Please sign in to comment.