-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.x backport: add burn tax split logic (#103)
* add burn tax split logic * add unit test for split tax ante
- Loading branch information
1 parent
f0ad7d8
commit f1c1b2a
Showing
20 changed files
with
472 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package v2 | ||
|
||
const UpgradeName = "v2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package v2 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
) | ||
|
||
func CreateV2UpgradeHandler( | ||
mm *module.Manager, | ||
cfg module.Configurator, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
return mm.RunMigrations(ctx, cfg, fromVM) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
|
||
rm -rf mytestnet | ||
pkill terrad | ||
|
||
BINARY=$1 | ||
DENOM=$2 | ||
|
||
SED_BINARY=sed | ||
# check if this is OS X | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# check if gsed is installed | ||
if ! command -v gsed &> /dev/null | ||
then | ||
echo "gsed could not be found. Please install it with 'brew install gnu-sed'" | ||
exit | ||
else | ||
SED_BINARY=gsed | ||
fi | ||
fi | ||
|
||
# check BINARY is set. If not, build terrad and set BINARY | ||
if [ -z "$BINARY" ]; then | ||
make build | ||
BINARY=build/terrad | ||
fi | ||
|
||
# check DENOM is set. If not, set to uluna | ||
if [ -z "$DENOM" ]; then | ||
DENOM=uluna | ||
fi | ||
|
||
HOME=mytestnet | ||
CHAIN_ID="test" | ||
KEYRING="test" | ||
KEY="test" | ||
KEY1="test1" | ||
KEY2="test2" | ||
|
||
# Function updates the config based on a jq argument as a string | ||
update_test_genesis () { | ||
# EX: update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"' | ||
cat $HOME/config/genesis.json | jq --arg DENOM "$2" "$1" > $HOME/config/tmp_genesis.json && mv $HOME/config/tmp_genesis.json $HOME/config/genesis.json | ||
} | ||
|
||
$BINARY init --chain-id $CHAIN_ID moniker --home $HOME | ||
|
||
$BINARY keys add $KEY --keyring-backend $KEYRING --home $HOME | ||
$BINARY keys add $KEY1 --keyring-backend $KEYRING --home $HOME | ||
$BINARY keys add $KEY2 --keyring-backend $KEYRING --home $HOME | ||
|
||
# Allocate genesis accounts (cosmos formatted addresses) | ||
$BINARY add-genesis-account $KEY "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME | ||
$BINARY add-genesis-account $KEY1 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME | ||
$BINARY add-genesis-account $KEY2 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME | ||
|
||
update_test_genesis '.app_state["gov"]["voting_params"]["voting_period"] = "50s"' | ||
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]=$DENOM' $DENOM | ||
update_test_genesis '.app_state["gov"]["deposit_params"]["min_deposit"]=[{"denom": $DENOM,"amount": "1000000"}]' $DENOM | ||
update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom": $DENOM,"amount": "1000"}' $DENOM | ||
update_test_genesis '.app_state["staking"]["params"]["bond_denom"]=$DENOM' $DENOM | ||
|
||
# enable rest server and swagger | ||
$SED_BINARY -i '0,/enable = false/s//enable = true/' $HOME/config/app.toml | ||
$SED_BINARY -i 's/swagger = false/swagger = true/' $HOME/config/app.toml | ||
|
||
# Sign genesis transaction | ||
$BINARY gentx $KEY "1000000${DENOM}" --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME | ||
|
||
# Collect genesis tx | ||
$BINARY collect-gentxs --home $HOME | ||
|
||
# Run this to ensure everything worked and that the genesis file is setup correctly | ||
$BINARY validate-genesis --home $HOME | ||
|
||
$BINARY start --home $HOME |
Oops, something went wrong.