Skip to content

Commit

Permalink
feat: Municipal Inflation (#330)
Browse files Browse the repository at this point in the history
* wip: pairing

* chore: specify municipal inflations commit

Signed-off-by: jonathansumner <jonathansumner98@gmail.com>

* Dockerfile: Enable aarch64 platform build (#320)

* feat: Municipal Inflation: support in Local Testnet Setup (#328)

* chore: update docker-compose.yml config + genesis setup script

Signed-off-by: jonathansumner <jonathansumner98@gmail.com>

* Adjusting setup for spectrum of municp.inf. from 3% to 100%

* Local testnet setup: Optional target adress for municipal infl.

---------

Signed-off-by: jonathansumner <jonathansumner98@gmail.com>
Co-authored-by: jonathansumner <jonathansumner98@gmail.com>

* Update Cosmos-SDK to v0.19.0 (Municipal Inflation release) (#329)

---------

Signed-off-by: jonathansumner <jonathansumner98@gmail.com>
Co-authored-by: jonathansumner <jonathansumner98@gmail.com>
  • Loading branch information
pbukva and Jonathansumner committed Aug 12, 2023
1 parent e5fe425 commit 28d8aa4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ services:
environment:
NUM_VALIDATORS: 3
CHAINID: localnet
# Address bellow generated from mnemonic of node0 using account=0 index=1 in HD path
MUNICIPAL_INFL_TARGET_ADDRESS: fetch12w7ud5hv93zu82as4d64tn00pc596ue2fs74tj

volumes:
- "setup-data:/setup"
Expand Down
26 changes: 26 additions & 0 deletions entrypoints/run-localnet-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def get_gentxs():


def main():
MUNICIPAL_INFL_TARGET_ADDRESS = 'MUNICIPAL_INFL_TARGET_ADDRESS'

for name in ('CHAINID', 'NUM_VALIDATORS'):
if name not in os.environ:
print('{} environment variable not present'.format(name))
Expand All @@ -47,6 +49,7 @@ def main():
# extract the environment variables
chain_id = os.environ['CHAINID']
num_validators = int(os.environ['NUM_VALIDATORS'])
municipal_infl_target_address = os.environ.get(MUNICIPAL_INFL_TARGET_ADDRESS, None)

# create the initial genesis file
if os.path.exists(GENESIS_PATH):
Expand All @@ -57,6 +60,17 @@ def main():
genesis = json.load(f)
genesis["app_state"]["staking"]["params"]["max_validators"] = 10
genesis["app_state"]["staking"]["params"]["max_entries"] = 10
municipal_infl_genesis_conf = genesis["app_state"]["mint"]["minter"]["municipal_inflation"]
if municipal_infl_target_address:
municipal_infl_genesis_conf.extend([
{"denom": "nanomobx", "inflation": {"target_address": municipal_infl_target_address, "value": "0.03"}},
{"denom": "denom005", "inflation": {"target_address": municipal_infl_target_address, "value": "0.05"}},
{"denom": "denom100", "inflation": {"target_address": municipal_infl_target_address, "value": "1.0"}},
{"denom": "denom010", "inflation": {"target_address": municipal_infl_target_address, "value": "0.1"}},
{"denom": "denom050", "inflation": {"target_address": municipal_infl_target_address, "value": "0.5"}},
{"denom": "denom020", "inflation": {"target_address": municipal_infl_target_address, "value": "0.2"}}
])

f.seek(0)
json.dump(genesis, f, indent=4)
f.truncate()
Expand All @@ -73,6 +87,18 @@ def main():
validator, '200000000000000000000atestfet']
subprocess.check_call(cmd)

if municipal_infl_target_address:
token_list = ["200000000000000000000atestfet"]

for infl in municipal_infl_genesis_conf:
token_list.append(f'{10**18}{infl["denom"]}')
tokens = ','.join(token_list)

cmd = ['fetchd', 'add-genesis-account',
municipal_infl_target_address, tokens]

subprocess.check_call(cmd)

# copy the generated genesis file
shutil.copy(GENESIS_PATH, '/setup/genesis.intermediate.json')

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/iavl v0.19.3 // indirect
github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
github.com/cosmos/ledger-go v0.9.3 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/danieljoos/wincred v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down Expand Up @@ -133,7 +133,7 @@ replace google.golang.org/grpc => google.golang.org/grpc v1.33.2

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/cosmos/cosmos-sdk => github.com/fetchai/cosmos-sdk v0.18.5-0.20230807121023-1d996e843ba9
replace github.com/cosmos/cosmos-sdk => github.com/fetchai/cosmos-sdk v0.19.0

replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0

Expand Down
7 changes: 3 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ github.com/cosmos/ibc-go/v3 v3.1.0/go.mod h1:DbOlOa4yKumaHGKApKkJN90L88PCjSD9ZBd
github.com/cosmos/interchain-accounts v0.1.0 h1:QmuwNsf1Hxl3P5GSGt7Z+JeuHPiZw4Z34R/038P5T6s=
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI=
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
github.com/cosmos/ledger-go v0.9.3 h1:WGyZK4ikuLIkbxJm3lEr1tdQYDdTdveTwoVla7hqfhQ=
github.com/cosmos/ledger-go v0.9.3/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down Expand Up @@ -231,8 +230,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fetchai/cosmos-sdk v0.18.5-0.20230807121023-1d996e843ba9 h1:uRF8puFVGBb4fYrbfRQYEnZUSFwD0GPFtj8DgQYdmik=
github.com/fetchai/cosmos-sdk v0.18.5-0.20230807121023-1d996e843ba9/go.mod h1:HQsH0e/ZQ0oTvUI1GOcT86lhfSSJjVXP4TItmiNFf6A=
github.com/fetchai/cosmos-sdk v0.19.0 h1:CH5J4Zc8fzweHn6B3UNEqSEmWQHuW/LrkglGtLaMprE=
github.com/fetchai/cosmos-sdk v0.19.0/go.mod h1:Izf5d8rmo/AO2YFWH6O8jZmK3dCHZcCOLggS7HtjB8c=
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
Expand Down

0 comments on commit 28d8aa4

Please sign in to comment.