Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Municipal Inflation #330

Merged
merged 8 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading