diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index b71ee5856..00431df3e 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -86,6 +86,7 @@
- [incentive/genesis.proto](#incentive/genesis.proto)
- [GenesisAccumulationTime](#botany.incentive.GenesisAccumulationTime)
+ - [GenesisDenoms](#botany.incentive.GenesisDenoms)
- [GenesisState](#botany.incentive.GenesisState)
- [incentive/query.proto](#incentive/query.proto)
@@ -475,7 +476,8 @@ GenesisState defines the botanydist module's genesis state.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#botany.botanydist.Params) | | |
-| `previous_block_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | this line is used by starport scaffolding # genesis/proto/state |
+| `previous_block_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | |
+| `gov_denom` | [string](#string) | | this line is used by starport scaffolding # genesis/proto/state |
@@ -1228,6 +1230,22 @@ Query defines the gRPC querier service.
+
+
+### GenesisDenoms
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `principal_denom` | [string](#string) | | |
+| `cdp_minting_reward_denom` | [string](#string) | | |
+
+
+
+
+
+
### GenesisState
@@ -1238,7 +1256,8 @@ GenesisState defines the incentive module's genesis state.
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#botany.incentive.Params) | | |
| `cdp_accumulation_times` | [GenesisAccumulationTime](#botany.incentive.GenesisAccumulationTime) | repeated | |
-| `cdp_minting_claims` | [CdpMintingClaim](#botany.incentive.CdpMintingClaim) | repeated | this line is used by starport scaffolding # genesis/proto/state |
+| `cdp_minting_claims` | [CdpMintingClaim](#botany.incentive.CdpMintingClaim) | repeated | |
+| `denoms` | [GenesisDenoms](#botany.incentive.GenesisDenoms) | | this line is used by starport scaffolding # genesis/proto/state |
diff --git a/go.mod b/go.mod
index fa9d97433..86638ba21 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/lcnem/jpyx
-go 1.16
+go 1.17
require (
github.com/cosmos/cosmos-sdk v0.42.9
@@ -21,6 +21,95 @@ require (
google.golang.org/protobuf v1.26.0
)
+require (
+ github.com/99designs/keyring v1.1.6 // indirect
+ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
+ github.com/DataDog/zstd v1.4.5 // indirect
+ github.com/Workiva/go-datastructures v1.0.52 // indirect
+ github.com/armon/go-metrics v0.3.8 // indirect
+ github.com/beorn7/perks v1.0.1 // indirect
+ github.com/bgentry/speakeasy v0.1.0 // indirect
+ github.com/btcsuite/btcd v0.21.0-beta // indirect
+ github.com/cespare/xxhash v1.1.0 // indirect
+ github.com/cespare/xxhash/v2 v2.1.1 // indirect
+ github.com/confio/ics23/go v0.6.6 // indirect
+ github.com/cosmos/go-bip39 v1.0.0 // indirect
+ github.com/cosmos/iavl v0.16.0 // indirect
+ github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
+ github.com/cosmos/ledger-go v0.9.2 // indirect
+ github.com/danieljoos/wincred v1.0.2 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/dgraph-io/badger/v2 v2.2007.2 // indirect
+ github.com/dgraph-io/ristretto v0.0.3 // indirect
+ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
+ github.com/dustin/go-humanize v1.0.0 // indirect
+ github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
+ github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 // indirect
+ github.com/felixge/httpsnoop v1.0.1 // indirect
+ github.com/fsnotify/fsnotify v1.4.9 // indirect
+ github.com/go-kit/kit v0.10.0 // indirect
+ github.com/go-logfmt/logfmt v0.5.0 // indirect
+ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
+ github.com/gogo/gateway v1.1.0 // indirect
+ github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 // indirect
+ github.com/google/btree v1.0.0 // indirect
+ github.com/google/orderedcode v0.0.1 // indirect
+ github.com/gorilla/handlers v1.5.1 // indirect
+ github.com/gorilla/websocket v1.4.2 // indirect
+ github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.0.1 // indirect
+ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
+ github.com/gtank/merlin v0.1.1 // indirect
+ github.com/gtank/ristretto255 v0.1.2 // indirect
+ github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
+ github.com/hashicorp/golang-lru v0.5.4 // indirect
+ github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/inconshreveable/mousetrap v1.0.0 // indirect
+ github.com/jmhodges/levigo v1.0.0 // indirect
+ github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
+ github.com/libp2p/go-buffer-pool v0.0.2 // indirect
+ github.com/magiconair/properties v1.8.5 // indirect
+ github.com/mattn/go-isatty v0.0.12 // indirect
+ github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
+ github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect
+ github.com/minio/highwayhash v1.0.1 // indirect
+ github.com/mitchellh/go-homedir v1.1.0 // indirect
+ github.com/mitchellh/mapstructure v1.3.3 // indirect
+ github.com/mtibben/percent v0.2.1 // indirect
+ github.com/pelletier/go-toml v1.8.1 // indirect
+ github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
+ github.com/pkg/errors v0.9.1 // indirect
+ github.com/pmezard/go-difflib v1.0.0 // indirect
+ github.com/prometheus/client_golang v1.10.0 // indirect
+ github.com/prometheus/client_model v0.2.0 // indirect
+ github.com/prometheus/common v0.23.0 // indirect
+ github.com/prometheus/procfs v0.6.0 // indirect
+ github.com/rakyll/statik v0.1.7 // indirect
+ github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
+ github.com/rs/cors v1.7.0 // indirect
+ github.com/rs/zerolog v1.21.0 // indirect
+ github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
+ github.com/spf13/afero v1.3.4 // indirect
+ github.com/spf13/jwalterweatherman v1.1.0 // indirect
+ github.com/spf13/viper v1.7.1 // indirect
+ github.com/subosito/gotenv v1.2.0 // indirect
+ github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect
+ github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
+ github.com/tendermint/btcd v0.1.1 // indirect
+ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
+ github.com/tendermint/go-amino v0.16.0 // indirect
+ github.com/zondax/hid v0.9.0 // indirect
+ go.etcd.io/bbolt v1.3.5 // indirect
+ golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
+ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
+ golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
+ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
+ golang.org/x/text v0.3.5 // indirect
+ gopkg.in/ini.v1 v1.61.0 // indirect
+ gopkg.in/yaml.v2 v2.4.0 // indirect
+ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
+)
+
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
diff --git a/launch/jpyx-3-test/genesis-pretty.json b/launch/jpyx-3-test/genesis-pretty.json
new file mode 100644
index 000000000..710dd3b5e
--- /dev/null
+++ b/launch/jpyx-3-test/genesis-pretty.json
@@ -0,0 +1,649 @@
+{
+ "genesis_time": "2021-04-12T05:11:20.803293303Z",
+ "chain_id": "jpyx-3-test",
+ "initial_height": "1",
+ "consensus_params": {
+ "block": {
+ "max_bytes": "22020096",
+ "max_gas": "-1",
+ "time_iota_ms": "1000"
+ },
+ "evidence": {
+ "max_age_num_blocks": "100000",
+ "max_age_duration": "172800000000000",
+ "max_bytes": "1048576"
+ },
+ "validator": {
+ "pub_key_types": [
+ "ed25519"
+ ]
+ },
+ "version": {}
+ },
+ "app_hash": "",
+ "app_state": {
+ "auction": {
+ "next_auction_id": "1",
+ "params": {
+ "max_auction_duration": "172800s",
+ "bid_duration": "3600s",
+ "increment_surplus": "0.050000000000000000",
+ "increment_debt": "0.050000000000000000",
+ "increment_collateral": "0.050000000000000000"
+ },
+ "auctions": []
+ },
+ "auth": {
+ "params": {
+ "max_memo_characters": "256",
+ "tx_sig_limit": "7",
+ "tx_size_cost_per_byte": "10",
+ "sig_verify_cost_ed25519": "590",
+ "sig_verify_cost_secp256k1": "1000"
+ },
+ "accounts": [
+ {
+ "@type": "/cosmos.auth.v1beta1.BaseAccount",
+ "address": "jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt",
+ "pub_key": null,
+ "account_number": "0",
+ "sequence": "0"
+ },
+ {
+ "@type": "/cosmos.auth.v1beta1.BaseAccount",
+ "address": "jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr",
+ "pub_key": null,
+ "account_number": "0",
+ "sequence": "0"
+ },
+ {
+ "@type": "/cosmos.auth.v1beta1.BaseAccount",
+ "address": "jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws",
+ "pub_key": null,
+ "account_number": "0",
+ "sequence": "0"
+ },
+ {
+ "@type": "/cosmos.auth.v1beta1.BaseAccount",
+ "address": "jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6",
+ "pub_key": null,
+ "account_number": "0",
+ "sequence": "0"
+ }
+ ]
+ },
+ "bank": {
+ "params": {
+ "send_enabled": [],
+ "default_send_enabled": true
+ },
+ "balances": [
+ {
+ "address": "jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr",
+ "coins": [
+ {
+ "denom": "ubtc",
+ "amount": "1000000"
+ },
+ {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ ]
+ },
+ {
+ "address": "jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt",
+ "coins": [
+ {
+ "denom": "ubtc",
+ "amount": "1000000"
+ },
+ {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ ]
+ },
+ {
+ "address": "jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6",
+ "coins": [
+ {
+ "denom": "ubtc",
+ "amount": "1000000"
+ },
+ {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ ]
+ },
+ {
+ "address": "jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws",
+ "coins": [
+ {
+ "denom": "ubtc",
+ "amount": "1000000"
+ },
+ {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ ]
+ }
+ ],
+ "supply": [],
+ "denom_metadata": []
+ },
+ "botanydist": {
+ "params": {
+ "active": false,
+ "periods": []
+ },
+ "previous_block_time": "1970-01-01T00:00:01Z",
+ "gov_denom": "ujsmn"
+ },
+ "capability": {
+ "index": "1",
+ "owners": []
+ },
+ "cdp": {
+ "params": {
+ "collateral_params": [
+ {
+ "auction_size": "50000000000",
+ "conversion_factor": "8",
+ "debt_limit": {
+ "amount": "20000000000000",
+ "denom": "jpyx"
+ },
+ "denom": "ubtc",
+ "liquidation_market_id": "ubtc:jpy:30",
+ "liquidation_penalty": "0.075000000000000000",
+ "liquidation_ratio": "1.500000000000000000",
+ "prefix": 1,
+ "spot_market_id": "ubtc:jpy",
+ "stability_fee": "1.000000001547125958",
+ "type": "ubtc-a",
+ "check_collateralization_index_count": "1000",
+ "keeper_reward_percentage": "0.000001"
+ }
+ ],
+ "debt_param": {
+ "denom": "jpyx",
+ "reference_asset": "jpy",
+ "conversion_factor": "6",
+ "debt_floor": "10000000"
+ },
+ "global_debt_limit": {
+ "denom": "jpyx",
+ "amount": "20000000000000"
+ },
+ "surplus_auction_threshold": "500000000000",
+ "surplus_auction_lot": "10000000000",
+ "debt_auction_threshold": "100000000000",
+ "debt_auction_lot": "10000000000",
+ "circuit_breaker": false
+ },
+ "cdps": [],
+ "deposits": [],
+ "starting_cdp_id": "1",
+ "debt_denom": "debt",
+ "gov_denom": "ujsmn",
+ "previous_accumulation_times": [],
+ "total_principals": []
+ },
+ "crisis": {
+ "constant_fee": {
+ "denom": "ujsmn",
+ "amount": "1000"
+ }
+ },
+ "distribution": {
+ "params": {
+ "community_tax": "0.020000000000000000",
+ "base_proposer_reward": "0.010000000000000000",
+ "bonus_proposer_reward": "0.040000000000000000",
+ "withdraw_addr_enabled": true
+ },
+ "fee_pool": {
+ "community_pool": []
+ },
+ "delegator_withdraw_infos": [],
+ "previous_proposer": "",
+ "outstanding_rewards": [],
+ "validator_accumulated_commissions": [],
+ "validator_historical_rewards": [],
+ "validator_current_rewards": [],
+ "delegator_starting_infos": [],
+ "validator_slash_events": []
+ },
+ "evidence": {
+ "evidence": []
+ },
+ "genutil": {
+ "gen_txs": [
+ {
+ "body": {
+ "messages": [
+ {
+ "@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
+ "description": {
+ "moniker": "lcnem-test-a",
+ "identity": "",
+ "website": "",
+ "security_contact": "",
+ "details": ""
+ },
+ "commission": {
+ "rate": "0.100000000000000000",
+ "max_rate": "0.200000000000000000",
+ "max_change_rate": "0.010000000000000000"
+ },
+ "min_self_delegation": "1",
+ "delegator_address": "jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt",
+ "validator_address": "jpyxvaloper10lcj22kzftvnduchatmnsnhfljeky5ghh3zpgf",
+ "pubkey": {
+ "@type": "/cosmos.crypto.ed25519.PubKey",
+ "key": "oYCrJpP1vlhMCh3K24FfWA5KE+KXrjkEfZENJOfVi64="
+ },
+ "value": {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ }
+ ],
+ "memo": "6fc4109698025d8ee20c09a78fd6b7fb858c26e2@a.test.jpyx.lcnem.net:26656",
+ "timeout_height": "0",
+ "extension_options": [],
+ "non_critical_extension_options": []
+ },
+ "auth_info": {
+ "signer_infos": [
+ {
+ "public_key": {
+ "@type": "/cosmos.crypto.secp256k1.PubKey",
+ "key": "AvSf2U/B23UZKvLTD0E4xqJ33Nn0Z552nXCkkwEfleiu"
+ },
+ "mode_info": {
+ "single": {
+ "mode": "SIGN_MODE_DIRECT"
+ }
+ },
+ "sequence": "0"
+ }
+ ],
+ "fee": {
+ "amount": [],
+ "gas_limit": "200000",
+ "payer": "",
+ "granter": ""
+ }
+ },
+ "signatures": [
+ "CjjyF5QQsL4ECP6JH12kUe6THnhc2WRKUPlL5wbTVG5vYvsNEGSKTYenGb+RV8X1PU6ujGh3+vzzX1BdKm7EvQ=="
+ ]
+ },
+ {
+ "body": {
+ "messages": [
+ {
+ "@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
+ "description": {
+ "moniker": "lcnem-test-b",
+ "identity": "",
+ "website": "",
+ "security_contact": "",
+ "details": ""
+ },
+ "commission": {
+ "rate": "0.100000000000000000",
+ "max_rate": "0.200000000000000000",
+ "max_change_rate": "0.010000000000000000"
+ },
+ "min_self_delegation": "1",
+ "delegator_address": "jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr",
+ "validator_address": "jpyxvaloper127jezdk0uvuupmfmqwwu0x5496d4kvkrjz8zsp",
+ "pubkey": {
+ "@type": "/cosmos.crypto.ed25519.PubKey",
+ "key": "XIsBycjHML6Dey2iAH6z6jXNer5TM+iKiBhEu9OK+0I="
+ },
+ "value": {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ }
+ ],
+ "memo": "7fc846bfde6ccd378dd736ac9976f63ed2afdd52@b.test.jpyx.lcnem.net:26656",
+ "timeout_height": "0",
+ "extension_options": [],
+ "non_critical_extension_options": []
+ },
+ "auth_info": {
+ "signer_infos": [
+ {
+ "public_key": {
+ "@type": "/cosmos.crypto.secp256k1.PubKey",
+ "key": "Ap0r/Ogj8yVCebZS9kLPQqLaZsd4BzXm1PoAt19j6pG1"
+ },
+ "mode_info": {
+ "single": {
+ "mode": "SIGN_MODE_DIRECT"
+ }
+ },
+ "sequence": "0"
+ }
+ ],
+ "fee": {
+ "amount": [],
+ "gas_limit": "200000",
+ "payer": "",
+ "granter": ""
+ }
+ },
+ "signatures": [
+ "VVFx3fqp2BgxW+YCFL0qFwBtFKPcz6a3phULZq6xuKVyGm1UFjR6CnJ/34MQ7D3xGsPMQR/0wmD8Q6PrWKfUCQ=="
+ ]
+ },
+ {
+ "body": {
+ "messages": [
+ {
+ "@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
+ "description": {
+ "moniker": "lcnem-test-d",
+ "identity": "",
+ "website": "",
+ "security_contact": "",
+ "details": ""
+ },
+ "commission": {
+ "rate": "0.100000000000000000",
+ "max_rate": "0.200000000000000000",
+ "max_change_rate": "0.010000000000000000"
+ },
+ "min_self_delegation": "1",
+ "delegator_address": "jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6",
+ "validator_address": "jpyxvaloper1ml9lnqk6t44cycxqp8la48mlaqg3lkaf24286c",
+ "pubkey": {
+ "@type": "/cosmos.crypto.ed25519.PubKey",
+ "key": "L2fO/hx5conb0q5xpOP91GunisUjAZh+0DAISFjQa9A="
+ },
+ "value": {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ }
+ ],
+ "memo": "d823c464320c4cdd1f9ae1d8595e3451cd97d520@d.test.jpyx.lcnem.net:26656",
+ "timeout_height": "0",
+ "extension_options": [],
+ "non_critical_extension_options": []
+ },
+ "auth_info": {
+ "signer_infos": [
+ {
+ "public_key": {
+ "@type": "/cosmos.crypto.secp256k1.PubKey",
+ "key": "A0HBN95gkH/HUPOdbTavbuqBNXbkv36GjiYxkjWeCQqo"
+ },
+ "mode_info": {
+ "single": {
+ "mode": "SIGN_MODE_DIRECT"
+ }
+ },
+ "sequence": "0"
+ }
+ ],
+ "fee": {
+ "amount": [],
+ "gas_limit": "200000",
+ "payer": "",
+ "granter": ""
+ }
+ },
+ "signatures": [
+ "7vK3EpUDLjdCTSTqC/ov3KpEZ/QgpSZbjrpxp13tNTtnQuo1xJiOxZyE6f/rkfxEX+lwV3e+NIOtPrqGv3owcg=="
+ ]
+ },
+ {
+ "body": {
+ "messages": [
+ {
+ "@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
+ "description": {
+ "moniker": "lcnem-test-c",
+ "identity": "",
+ "website": "",
+ "security_contact": "",
+ "details": ""
+ },
+ "commission": {
+ "rate": "0.100000000000000000",
+ "max_rate": "0.200000000000000000",
+ "max_change_rate": "0.010000000000000000"
+ },
+ "min_self_delegation": "1",
+ "delegator_address": "jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws",
+ "validator_address": "jpyxvaloper17zy4kkqrv5f5f8pdr7r58066gtr04jtst7kpgj",
+ "pubkey": {
+ "@type": "/cosmos.crypto.ed25519.PubKey",
+ "key": "E+YHPHgxEr/zy/52x1QyShFLn9LTyYrpmN3lum9Y8Ys="
+ },
+ "value": {
+ "denom": "ujsmn",
+ "amount": "250000000000"
+ }
+ }
+ ],
+ "memo": "e676f54115ea73f893a1cc5ba4c334f5524f57ca@c.test.jpyx.lcnem.net:26656",
+ "timeout_height": "0",
+ "extension_options": [],
+ "non_critical_extension_options": []
+ },
+ "auth_info": {
+ "signer_infos": [
+ {
+ "public_key": {
+ "@type": "/cosmos.crypto.secp256k1.PubKey",
+ "key": "Att2SHt6uB6Y3eKJHmDGa3ZVhHkL9IHoWeejCyfpA0s3"
+ },
+ "mode_info": {
+ "single": {
+ "mode": "SIGN_MODE_DIRECT"
+ }
+ },
+ "sequence": "0"
+ }
+ ],
+ "fee": {
+ "amount": [],
+ "gas_limit": "200000",
+ "payer": "",
+ "granter": ""
+ }
+ },
+ "signatures": [
+ "x/EJsVYVVlpXkGSKz/9YaOfHocCrON84SUsUnAcS9H0topK76Mbp9Fyvksfj4fMmv/68NFJ+ySHzhmniLj2BSA=="
+ ]
+ }
+ ]
+ },
+ "gov": {
+ "starting_proposal_id": "1",
+ "deposits": [],
+ "votes": [],
+ "proposals": [],
+ "deposit_params": {
+ "min_deposit": [
+ {
+ "denom": "ujsmn",
+ "amount": "10000000"
+ }
+ ],
+ "max_deposit_period": "172800s"
+ },
+ "voting_params": {
+ "voting_period": "172800s"
+ },
+ "tally_params": {
+ "quorum": "0.334000000000000000",
+ "threshold": "0.500000000000000000",
+ "veto_threshold": "0.334000000000000000"
+ }
+ },
+ "ibc": {
+ "client_genesis": {
+ "clients": [],
+ "clients_consensus": [],
+ "clients_metadata": [],
+ "params": {
+ "allowed_clients": [
+ "06-solomachine",
+ "07-tendermint"
+ ]
+ },
+ "create_localhost": false,
+ "next_client_sequence": "0"
+ },
+ "connection_genesis": {
+ "connections": [],
+ "client_connection_paths": [],
+ "next_connection_sequence": "0"
+ },
+ "channel_genesis": {
+ "channels": [],
+ "acknowledgements": [],
+ "commitments": [],
+ "receipts": [],
+ "send_sequences": [],
+ "recv_sequences": [],
+ "ack_sequences": [],
+ "next_channel_sequence": "0"
+ }
+ },
+ "incentive": {
+ "params": {
+ "cdp_minting_reward_periods": [],
+ "claim_multipliers": [],
+ "claim_end": "1970-01-01T00:00:01Z"
+ },
+ "cdp_accumulation_times": [],
+ "cdp_minting_claims": [],
+ "denoms": {
+ "principal_denom": "jpyx",
+ "cdp_minting_reward_denom": "ujsmn"
+ }
+ },
+ "liquidity": {
+ "params": {
+ "pool_types": [
+ {
+ "id": 1,
+ "name": "StandardLiquidityPool",
+ "min_reserve_coin_num": 2,
+ "max_reserve_coin_num": 2,
+ "description": "Standard liquidity pool with pool price function X/Y, ESPM constraint, and two kinds of reserve coins"
+ }
+ ],
+ "min_init_deposit_amount": "1000000",
+ "init_pool_coin_mint_amount": "1000000",
+ "max_reserve_coin_amount": "0",
+ "pool_creation_fee": [
+ {
+ "denom": "stake",
+ "amount": "40000000"
+ }
+ ],
+ "swap_fee_rate": "0.003000000000000000",
+ "withdraw_fee_rate": "0.000000000000000000",
+ "max_order_amount_ratio": "0.100000000000000000",
+ "unit_batch_height": 1,
+ "circuit_breaker_enabled": false
+ },
+ "pool_records": []
+ },
+ "mint": {
+ "minter": {
+ "inflation": "0.130000000000000000",
+ "annual_provisions": "0.000000000000000000"
+ },
+ "params": {
+ "mint_denom": "ujsmn",
+ "inflation_rate_change": "0.130000000000000000",
+ "inflation_max": "0.200000000000000000",
+ "inflation_min": "0.070000000000000000",
+ "goal_bonded": "0.670000000000000000",
+ "blocks_per_year": "6311520"
+ }
+ },
+ "params": null,
+ "pricefeed": {
+ "params": {
+ "markets": [
+ {
+ "market_id": "ubtc:jpy",
+ "base_asset": "ubtc",
+ "quote_asset": "jpy",
+ "oracles": [
+ "jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt",
+ "jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr",
+ "jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws",
+ "jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6"
+ ],
+ "active": true
+ },
+ {
+ "market_id": "ubtc:jpy:30",
+ "base_asset": "ubtc",
+ "quote_asset": "jpy",
+ "oracles": [
+ "jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt",
+ "jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr",
+ "jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws",
+ "jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6"
+ ],
+ "active": true
+ }
+ ]
+ },
+ "posted_prices": []
+ },
+ "slashing": {
+ "params": {
+ "signed_blocks_window": "100",
+ "min_signed_per_window": "0.500000000000000000",
+ "downtime_jail_duration": "600s",
+ "slash_fraction_double_sign": "0.050000000000000000",
+ "slash_fraction_downtime": "0.010000000000000000"
+ },
+ "signing_infos": [],
+ "missed_blocks": []
+ },
+ "staking": {
+ "params": {
+ "unbonding_time": "1814400s",
+ "max_validators": 100,
+ "max_entries": 7,
+ "historical_entries": 10000,
+ "bond_denom": "ujsmn"
+ },
+ "last_total_power": "0",
+ "last_validator_powers": [],
+ "validators": [],
+ "delegations": [],
+ "unbonding_delegations": [],
+ "redelegations": [],
+ "exported": false
+ },
+ "transfer": {
+ "port_id": "transfer",
+ "denom_traces": [],
+ "params": {
+ "send_enabled": true,
+ "receive_enabled": true
+ }
+ },
+ "upgrade": {},
+ "vesting": {}
+ }
+}
\ No newline at end of file
diff --git a/launch/jpyx-3-test/genesis.json b/launch/jpyx-3-test/genesis.json
new file mode 100644
index 000000000..9c2c01a2a
--- /dev/null
+++ b/launch/jpyx-3-test/genesis.json
@@ -0,0 +1 @@
+{"genesis_time":"2021-04-12T05:11:20.803293303Z","chain_id":"jpyx-3-test","initial_height":"1","consensus_params":{"block":{"max_bytes":"22020096","max_gas":"-1","time_iota_ms":"1000"},"evidence":{"max_age_num_blocks":"100000","max_age_duration":"172800000000000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{}},"app_hash":"","app_state":{"auction":{"next_auction_id":"1","params":{"max_auction_duration":"172800s","bid_duration":"3600s","increment_surplus":"0.050000000000000000","increment_debt":"0.050000000000000000","increment_collateral":"0.050000000000000000"},"auctions":[]},"auth":{"params":{"max_memo_characters":"256","tx_sig_limit":"7","tx_size_cost_per_byte":"10","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000"},"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","address":"jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt","pub_key":null,"account_number":"0","sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","address":"jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr","pub_key":null,"account_number":"0","sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","address":"jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws","pub_key":null,"account_number":"0","sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","address":"jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6","pub_key":null,"account_number":"0","sequence":"0"}]},"bank":{"params":{"send_enabled":[],"default_send_enabled":true},"balances":[{"address":"jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr","coins":[{"denom":"ubtc","amount":"1000000"},{"denom":"ujsmn","amount":"250000000000"}]},{"address":"jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt","coins":[{"denom":"ubtc","amount":"1000000"},{"denom":"ujsmn","amount":"250000000000"}]},{"address":"jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6","coins":[{"denom":"ubtc","amount":"1000000"},{"denom":"ujsmn","amount":"250000000000"}]},{"address":"jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws","coins":[{"denom":"ubtc","amount":"1000000"},{"denom":"ujsmn","amount":"250000000000"}]}],"supply":[],"denom_metadata":[]},"botanydist":{"params":{"active":false,"periods":[]},"previous_block_time":"1970-01-01T00:00:01Z","gov_denom":"ujsmn"},"capability":{"index":"1","owners":[]},"cdp":{"params":{"collateral_params":[{"auction_size":"50000000000","conversion_factor":"8","debt_limit":{"amount":"20000000000000","denom":"jpyx"},"denom":"ubtc","liquidation_market_id":"ubtc:jpy:30","liquidation_penalty":"0.075000000000000000","liquidation_ratio":"1.500000000000000000","prefix":1,"spot_market_id":"ubtc:jpy","stability_fee":"1.000000001547125958","type":"ubtc-a","check_collateralization_index_count":"1000","keeper_reward_percentage":"0.000001"}],"debt_param":{"denom":"jpyx","reference_asset":"jpy","conversion_factor":"6","debt_floor":"10000000"},"global_debt_limit":{"denom":"jpyx","amount":"20000000000000"},"surplus_auction_threshold":"500000000000","surplus_auction_lot":"10000000000","debt_auction_threshold":"100000000000","debt_auction_lot":"10000000000","circuit_breaker":false},"cdps":[],"deposits":[],"starting_cdp_id":"1","debt_denom":"debt","gov_denom":"ujsmn","previous_accumulation_times":[],"total_principals":[]},"crisis":{"constant_fee":{"denom":"ujsmn","amount":"1000"}},"distribution":{"params":{"community_tax":"0.020000000000000000","base_proposer_reward":"0.010000000000000000","bonus_proposer_reward":"0.040000000000000000","withdraw_addr_enabled":true},"fee_pool":{"community_pool":[]},"delegator_withdraw_infos":[],"previous_proposer":"","outstanding_rewards":[],"validator_accumulated_commissions":[],"validator_historical_rewards":[],"validator_current_rewards":[],"delegator_starting_infos":[],"validator_slash_events":[]},"evidence":{"evidence":[]},"genutil":{"gen_txs":[{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"lcnem-test-a","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt","validator_address":"jpyxvaloper10lcj22kzftvnduchatmnsnhfljeky5ghh3zpgf","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"oYCrJpP1vlhMCh3K24FfWA5KE+KXrjkEfZENJOfVi64="},"value":{"denom":"ujsmn","amount":"250000000000"}}],"memo":"6fc4109698025d8ee20c09a78fd6b7fb858c26e2@a.test.jpyx.lcnem.net:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AvSf2U/B23UZKvLTD0E4xqJ33Nn0Z552nXCkkwEfleiu"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["CjjyF5QQsL4ECP6JH12kUe6THnhc2WRKUPlL5wbTVG5vYvsNEGSKTYenGb+RV8X1PU6ujGh3+vzzX1BdKm7EvQ=="]},{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"lcnem-test-b","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr","validator_address":"jpyxvaloper127jezdk0uvuupmfmqwwu0x5496d4kvkrjz8zsp","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"XIsBycjHML6Dey2iAH6z6jXNer5TM+iKiBhEu9OK+0I="},"value":{"denom":"ujsmn","amount":"250000000000"}}],"memo":"7fc846bfde6ccd378dd736ac9976f63ed2afdd52@b.test.jpyx.lcnem.net:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ap0r/Ogj8yVCebZS9kLPQqLaZsd4BzXm1PoAt19j6pG1"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["VVFx3fqp2BgxW+YCFL0qFwBtFKPcz6a3phULZq6xuKVyGm1UFjR6CnJ/34MQ7D3xGsPMQR/0wmD8Q6PrWKfUCQ=="]},{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"lcnem-test-d","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6","validator_address":"jpyxvaloper1ml9lnqk6t44cycxqp8la48mlaqg3lkaf24286c","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"L2fO/hx5conb0q5xpOP91GunisUjAZh+0DAISFjQa9A="},"value":{"denom":"ujsmn","amount":"250000000000"}}],"memo":"d823c464320c4cdd1f9ae1d8595e3451cd97d520@d.test.jpyx.lcnem.net:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A0HBN95gkH/HUPOdbTavbuqBNXbkv36GjiYxkjWeCQqo"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["7vK3EpUDLjdCTSTqC/ov3KpEZ/QgpSZbjrpxp13tNTtnQuo1xJiOxZyE6f/rkfxEX+lwV3e+NIOtPrqGv3owcg=="]},{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"lcnem-test-c","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws","validator_address":"jpyxvaloper17zy4kkqrv5f5f8pdr7r58066gtr04jtst7kpgj","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"E+YHPHgxEr/zy/52x1QyShFLn9LTyYrpmN3lum9Y8Ys="},"value":{"denom":"ujsmn","amount":"250000000000"}}],"memo":"e676f54115ea73f893a1cc5ba4c334f5524f57ca@c.test.jpyx.lcnem.net:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Att2SHt6uB6Y3eKJHmDGa3ZVhHkL9IHoWeejCyfpA0s3"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["x/EJsVYVVlpXkGSKz/9YaOfHocCrON84SUsUnAcS9H0topK76Mbp9Fyvksfj4fMmv/68NFJ+ySHzhmniLj2BSA=="]}]},"gov":{"starting_proposal_id":"1","deposits":[],"votes":[],"proposals":[],"deposit_params":{"min_deposit":[{"denom":"ujsmn","amount":"10000000"}],"max_deposit_period":"172800s"},"voting_params":{"voting_period":"172800s"},"tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"}},"ibc":{"client_genesis":{"clients":[],"clients_consensus":[],"clients_metadata":[],"params":{"allowed_clients":["06-solomachine","07-tendermint"]},"create_localhost":false,"next_client_sequence":"0"},"connection_genesis":{"connections":[],"client_connection_paths":[],"next_connection_sequence":"0"},"channel_genesis":{"channels":[],"acknowledgements":[],"commitments":[],"receipts":[],"send_sequences":[],"recv_sequences":[],"ack_sequences":[],"next_channel_sequence":"0"}},"incentive":{"params":{"cdp_minting_reward_periods":[],"claim_multipliers":[],"claim_end":"1970-01-01T00:00:01Z"},"cdp_accumulation_times":[],"cdp_minting_claims":[],"denoms":{"principal_denom":"jpyx","cdp_minting_reward_denom":"ujsmn"}},"liquidity":{"params":{"pool_types":[{"id":1,"name":"StandardLiquidityPool","min_reserve_coin_num":2,"max_reserve_coin_num":2,"description":"Standard liquidity pool with pool price function X/Y, ESPM constraint, and two kinds of reserve coins"}],"min_init_deposit_amount":"1000000","init_pool_coin_mint_amount":"1000000","max_reserve_coin_amount":"0","pool_creation_fee":[{"denom":"stake","amount":"40000000"}],"swap_fee_rate":"0.003000000000000000","withdraw_fee_rate":"0.000000000000000000","max_order_amount_ratio":"0.100000000000000000","unit_batch_height":1,"circuit_breaker_enabled":false},"pool_records":[]},"mint":{"minter":{"inflation":"0.130000000000000000","annual_provisions":"0.000000000000000000"},"params":{"mint_denom":"ujsmn","inflation_rate_change":"0.130000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","goal_bonded":"0.670000000000000000","blocks_per_year":"6311520"}},"params":null,"pricefeed":{"params":{"markets":[{"market_id":"ubtc:jpy","base_asset":"ubtc","quote_asset":"jpy","oracles":["jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt","jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr","jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws","jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6"],"active":true},{"market_id":"ubtc:jpy:30","base_asset":"ubtc","quote_asset":"jpy","oracles":["jpyx10lcj22kzftvnduchatmnsnhfljeky5ghd398wt","jpyx127jezdk0uvuupmfmqwwu0x5496d4kvkrgzqykr","jpyx17zy4kkqrv5f5f8pdr7r58066gtr04jts3738ws","jpyx1ml9lnqk6t44cycxqp8la48mlaqg3lkafs4dpu6"],"active":true}]},"posted_prices":[]},"slashing":{"params":{"signed_blocks_window":"100","min_signed_per_window":"0.500000000000000000","downtime_jail_duration":"600s","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[],"missed_blocks":[]},"staking":{"params":{"unbonding_time":"1814400s","max_validators":100,"max_entries":7,"historical_entries":10000,"bond_denom":"ujsmn"},"last_total_power":"0","last_validator_powers":[],"validators":[],"delegations":[],"unbonding_delegations":[],"redelegations":[],"exported":false},"transfer":{"port_id":"transfer","denom_traces":[],"params":{"send_enabled":true,"receive_enabled":true}},"upgrade":{},"vesting":{}}}
\ No newline at end of file
diff --git a/proto/botanydist/genesis.proto b/proto/botanydist/genesis.proto
index f3f3b95e5..f6d172cc5 100644
--- a/proto/botanydist/genesis.proto
+++ b/proto/botanydist/genesis.proto
@@ -19,5 +19,6 @@ message GenesisState {
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true
];
+ string gov_denom = 3 [(gogoproto.moretags) = "yaml:\"gov_denom\""];
// this line is used by starport scaffolding # genesis/proto/state
}
diff --git a/proto/incentive/genesis.proto b/proto/incentive/genesis.proto
index d1336b85a..797cf6563 100644
--- a/proto/incentive/genesis.proto
+++ b/proto/incentive/genesis.proto
@@ -22,6 +22,7 @@ message GenesisState {
(gogoproto.moretags) = "yaml:\"cdp_minting_claims\"",
(gogoproto.nullable) = false
];
+ GenesisDenoms denoms = 4 [(gogoproto.moretags) = "yaml:\"denoms\""];
// this line is used by starport scaffolding # genesis/proto/state
}
@@ -33,3 +34,8 @@ message GenesisAccumulationTime {
(gogoproto.stdtime) = true
];
}
+
+message GenesisDenoms {
+ string principal_denom = 1 [(gogoproto.moretags) = "yaml:\"principal_denom\""];
+ string cdp_minting_reward_denom = 2 [(gogoproto.moretags) = "yaml:\"principal_denom\""];
+}
diff --git a/proto/incentive/incentive.proto b/proto/incentive/incentive.proto
index 65d3cb744..f6db78353 100644
--- a/proto/incentive/incentive.proto
+++ b/proto/incentive/incentive.proto
@@ -8,16 +8,16 @@ import "cosmos/base/v1beta1/coin.proto";
option go_package = "github.com/lcnem/jpyx/x/incentive/types";
message BaseClaim {
- string owner = 1 [
- (gogoproto.moretags) = "yaml:\"owner\"",
- (gogoproto.customtype) = "github.com/lcnem/jpyx/types.StringAccAddress",
- (gogoproto.nullable) = false
- ];
- cosmos.base.v1beta1.Coin reward = 2 [
- (gogoproto.moretags) = "yaml:\"reward\"",
- (gogoproto.nullable) = false
- ];
- }
+ string owner = 1 [
+ (gogoproto.moretags) = "yaml:\"owner\"",
+ (gogoproto.customtype) = "github.com/lcnem/jpyx/types.StringAccAddress",
+ (gogoproto.nullable) = false
+ ];
+ cosmos.base.v1beta1.Coin reward = 2 [
+ (gogoproto.moretags) = "yaml:\"reward\"",
+ (gogoproto.nullable) = false
+ ];
+}
message BaseMultiClaim {
string owner = 1 [
diff --git a/x/botanydist/genesis.go b/x/botanydist/genesis.go
index fe965f56b..e2e101049 100644
--- a/x/botanydist/genesis.go
+++ b/x/botanydist/genesis.go
@@ -27,6 +27,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKe
panic(fmt.Sprintf("%s module account has not been set", types.BotanydistMacc))
}
+ k.SetGovDenom(ctx, gs.GovDenom)
}
// ExportGenesis export genesis state for cdp module
@@ -36,5 +37,9 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
if !found {
previousBlockTime = types.DefaultPreviousBlockTime
}
- return types.NewGenesisState(params, previousBlockTime)
+ govDenom, found := k.GetGovDenom(ctx)
+ if !found {
+ govDenom = types.DefaultGovDenom
+ }
+ return types.NewGenesisState(params, previousBlockTime, govDenom)
}
diff --git a/x/botanydist/keeper/keeper.go b/x/botanydist/keeper/keeper.go
index 4f003f9fe..dea9c6823 100644
--- a/x/botanydist/keeper/keeper.go
+++ b/x/botanydist/keeper/keeper.go
@@ -46,7 +46,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
// GetPreviousBlockTime get the blocktime for the previous block
func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time, found bool) {
store := ctx.KVStore(k.storeKey)
- b := store.Get(types.KeyPrefix(types.PreviousBlockTime))
+ b := store.Get(types.KeyPrefix(types.PreviousBlockTimeKey))
if b == nil {
return time.Time{}, false
}
@@ -59,5 +59,19 @@ func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time, foun
func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time) {
store := ctx.KVStore(k.storeKey)
b, _ := blockTime.MarshalBinary()
- store.Set(types.KeyPrefix(types.PreviousBlockTime), b)
+ store.Set(types.KeyPrefix(types.PreviousBlockTimeKey), b)
+}
+
+func (k Keeper) GetGovDenom(ctx sdk.Context) (govDenom string, found bool) {
+ store := ctx.KVStore(k.storeKey)
+ b := store.Get(types.KeyPrefix(types.GovDenomKey))
+ govDenom = string(b)
+
+ return govDenom, true
+}
+
+func (k Keeper) SetGovDenom(ctx sdk.Context, govDenom string) {
+ store := ctx.KVStore(k.storeKey)
+ b := []byte(govDenom)
+ store.Set(types.KeyPrefix(types.GovDenomKey), b)
}
diff --git a/x/botanydist/keeper/mint.go b/x/botanydist/keeper/mint.go
index ce1833d53..f31f8b5bb 100644
--- a/x/botanydist/keeper/mint.go
+++ b/x/botanydist/keeper/mint.go
@@ -38,7 +38,8 @@ func (k Keeper) MintPeriodInflation(ctx sdk.Context) error {
case period.End.After(previousBlockTime) && period.End.Before(ctx.BlockTime()):
// calculate time elapsed relative to the periods end time
timeElapsed := sdk.NewInt(period.End.Unix() - previousBlockTime.Unix())
- err = k.mintInflationaryCoins(ctx, period.Inflation, timeElapsed, types.GovDenom)
+ govDenom, _ := k.GetGovDenom(ctx)
+ err = k.mintInflationaryCoins(ctx, period.Inflation, timeElapsed, govDenom)
// update the value of previousBlockTime so that the next period starts from the end of the last
// period and not the original value of previousBlockTime
previousBlockTime = period.End
@@ -47,7 +48,8 @@ func (k Keeper) MintPeriodInflation(ctx sdk.Context) error {
case (period.Start.Before(previousBlockTime) || period.Start.Equal(previousBlockTime)) && period.End.After(ctx.BlockTime()):
// calculate time elapsed relative to the current block time
timeElapsed := sdk.NewInt(ctx.BlockTime().Unix() - previousBlockTime.Unix())
- err = k.mintInflationaryCoins(ctx, period.Inflation, timeElapsed, types.GovDenom)
+ govDenom, _ := k.GetGovDenom(ctx)
+ err = k.mintInflationaryCoins(ctx, period.Inflation, timeElapsed, govDenom)
// Case 4 - period hasn't started
case period.Start.After(ctx.BlockTime()) || period.Start.Equal(ctx.BlockTime()):
diff --git a/x/botanydist/keeper/mint_test.go b/x/botanydist/keeper/mint_test.go
index 59e1b918e..06db84130 100644
--- a/x/botanydist/keeper/mint_test.go
+++ b/x/botanydist/keeper/mint_test.go
@@ -49,7 +49,7 @@ func (suite *KeeperTestSuite) SetupTest() {
ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})
params := botanydisttypes.NewParams(true, testPeriods)
- jsmnGs := botanydisttypes.NewGenesisState(params, botanydisttypes.DefaultPreviousBlockTime)
+ jsmnGs := botanydisttypes.NewGenesisState(params, botanydisttypes.DefaultPreviousBlockTime, botanydisttypes.DefaultGovDenom)
// gs := app.GenesisState{botanydisttypes.ModuleName: botanydisttypes.ModuleCdc.MustMarshalJSON(botanydisttypes.NewGenesisState(params, botanydisttypes.DefaultPreviousBlockTime))}
gs := app.GenesisState{botanydisttypes.ModuleName: botanydisttypes.ModuleCdc.MustMarshalJSON(&jsmnGs)}
tApp.InitializeFromGenesisStates(
@@ -69,32 +69,35 @@ func (suite *KeeperTestSuite) SetupTest() {
}
func (suite *KeeperTestSuite) TestMintExpiredPeriod() {
+ govDenom, _ := suite.keeper.GetGovDenom(suite.ctx)
// initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(govDenom)
suite.NotPanics(func() { suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC)) })
ctx := suite.ctx.WithBlockTime(time.Date(2022, 1, 1, 0, 7, 0, 0, time.UTC))
err := suite.keeper.MintPeriodInflation(ctx)
suite.NoError(err)
// finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(govDenom)
suite.Equal(initialSupply, finalSupply)
}
func (suite *KeeperTestSuite) TestMintPeriodNotStarted() {
+ govDenom, _ := suite.keeper.GetGovDenom(suite.ctx)
// initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(govDenom)
suite.NotPanics(func() { suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)) })
ctx := suite.ctx.WithBlockTime(time.Date(2019, 1, 1, 0, 7, 0, 0, time.UTC))
err := suite.keeper.MintPeriodInflation(ctx)
suite.NoError(err)
// finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(govDenom)
suite.Equal(initialSupply, finalSupply)
}
func (suite *KeeperTestSuite) TestMintOngoingPeriod() {
+ govDenom, _ := suite.keeper.GetGovDenom(suite.ctx)
// initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(govDenom)
suite.NotPanics(func() {
suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2020, time.March, 1, 1, 0, 1, 0, time.UTC))
})
@@ -102,13 +105,13 @@ func (suite *KeeperTestSuite) TestMintOngoingPeriod() {
err := suite.keeper.MintPeriodInflation(ctx)
suite.NoError(err)
// finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(govDenom)
suite.True(finalSupply.GT(initialSupply))
// mAcc := suite.supplyKeeper.GetModuleAccount(ctx, botanydisttypes.ModuleName)
// mAccSupply := mAcc.GetCoins().AmountOf(botanydisttypes.GovDenom)
// suite.True(mAccSupply.Equal(finalSupply.Sub(initialSupply)))
mAddr := suite.accountKeeper.GetModuleAddress(botanydisttypes.ModuleName)
- mAddrSupply := suite.bankKeeper.GetAllBalances(ctx, mAddr).AmountOf(botanydisttypes.GovDenom)
+ mAddrSupply := suite.bankKeeper.GetAllBalances(ctx, mAddr).AmountOf(govDenom)
suite.True(mAddrSupply.Equal(finalSupply.Sub(initialSupply)))
// expect that inflation is ~10%
expectedSupply := sdk.NewDecFromInt(initialSupply).Mul(sdk.MustNewDecFromStr("1.1"))
@@ -117,8 +120,9 @@ func (suite *KeeperTestSuite) TestMintOngoingPeriod() {
}
func (suite *KeeperTestSuite) TestMintPeriodTransition() {
+ govDenom, _ := suite.keeper.GetGovDenom(suite.ctx)
// initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(govDenom)
params := suite.keeper.GetParams(suite.ctx)
periods := botanydisttypes.Periods{
testPeriods[0],
@@ -139,13 +143,14 @@ func (suite *KeeperTestSuite) TestMintPeriodTransition() {
err := suite.keeper.MintPeriodInflation(ctx)
suite.NoError(err)
// finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(govDenom)
suite.True(finalSupply.GT(initialSupply))
}
func (suite *KeeperTestSuite) TestMintNotActive() {
+ govDenom, _ := suite.keeper.GetGovDenom(suite.ctx)
// initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ initialSupply := suite.bankKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(govDenom)
params := suite.keeper.GetParams(suite.ctx)
params.Active = false
suite.NotPanics(func() {
@@ -158,7 +163,7 @@ func (suite *KeeperTestSuite) TestMintNotActive() {
err := suite.keeper.MintPeriodInflation(ctx)
suite.NoError(err)
// finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
- finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(botanydisttypes.GovDenom)
+ finalSupply := suite.bankKeeper.GetSupply(ctx).GetTotal().AmountOf(govDenom)
suite.Equal(initialSupply, finalSupply)
}
diff --git a/x/botanydist/types/genesis.go b/x/botanydist/types/genesis.go
index 41fa38f99..bd4738838 100644
--- a/x/botanydist/types/genesis.go
+++ b/x/botanydist/types/genesis.go
@@ -16,6 +16,7 @@ func DefaultGenesis() *GenesisState {
return &GenesisState{
Params: DefaultParams(),
PreviousBlockTime: DefaultPreviousBlockTime,
+ GovDenom: DefaultGovDenom,
// this line is used by starport scaffolding # genesis/types/default
}
}
@@ -32,14 +33,18 @@ func (gs GenesisState) Validate() error {
if gs.PreviousBlockTime.Equal(time.Time{}) {
return fmt.Errorf("previous block time not set")
}
+ if len(gs.GovDenom) == 0 {
+ return fmt.Errorf("GovDenom is nil or empty")
+ }
return nil
}
// NewGenesisState returns a new genesis state
-func NewGenesisState(params Params, previousBlockTime time.Time) GenesisState {
+func NewGenesisState(params Params, previousBlockTime time.Time, govDenom string) GenesisState {
return GenesisState{
Params: params,
PreviousBlockTime: previousBlockTime,
+ GovDenom: govDenom,
}
}
diff --git a/x/botanydist/types/genesis.pb.go b/x/botanydist/types/genesis.pb.go
index b8302ce8a..641397dd1 100644
--- a/x/botanydist/types/genesis.pb.go
+++ b/x/botanydist/types/genesis.pb.go
@@ -31,6 +31,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"`
PreviousBlockTime time.Time `protobuf:"bytes,2,opt,name=previous_block_time,json=previousBlockTime,proto3,stdtime" json:"previous_block_time" yaml:"previous_block_time"`
+ GovDenom string `protobuf:"bytes,3,opt,name=gov_denom,json=govDenom,proto3" json:"gov_denom,omitempty" yaml:"gov_denom"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -80,6 +81,13 @@ func (m *GenesisState) GetPreviousBlockTime() time.Time {
return time.Time{}
}
+func (m *GenesisState) GetGovDenom() string {
+ if m != nil {
+ return m.GovDenom
+ }
+ return ""
+}
+
func init() {
proto.RegisterType((*GenesisState)(nil), "botany.botanydist.GenesisState")
}
@@ -87,26 +95,28 @@ func init() {
func init() { proto.RegisterFile("botanydist/genesis.proto", fileDescriptor_b48b45eb6e98adc4) }
var fileDescriptor_b48b45eb6e98adc4 = []byte{
- // 289 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x31, 0x4e, 0xc3, 0x30,
- 0x14, 0x86, 0x63, 0x86, 0x0e, 0x01, 0x86, 0x16, 0x90, 0x42, 0x90, 0x1c, 0x94, 0x01, 0x75, 0xb2,
- 0x25, 0xd8, 0x18, 0xb3, 0xc0, 0x88, 0x0a, 0x13, 0x4b, 0xe5, 0x04, 0x63, 0x02, 0x71, 0x9e, 0x15,
- 0x3b, 0xa8, 0xb9, 0x45, 0x8f, 0xd5, 0x81, 0xa1, 0x23, 0x53, 0x41, 0xc9, 0x0d, 0x38, 0x01, 0x4a,
- 0x9c, 0xa8, 0x95, 0xba, 0x3d, 0xeb, 0xfb, 0xdf, 0xff, 0x3e, 0xd9, 0xf5, 0x62, 0x30, 0x2c, 0xaf,
- 0x5e, 0x52, 0x6d, 0xa8, 0xe0, 0x39, 0xd7, 0xa9, 0x26, 0xaa, 0x00, 0x03, 0x93, 0xb1, 0x25, 0x64,
- 0x1b, 0xf0, 0x4f, 0x05, 0x08, 0xe8, 0x28, 0x6d, 0x27, 0x1b, 0xf4, 0x03, 0x01, 0x20, 0x32, 0x4e,
- 0xbb, 0x57, 0x5c, 0xbe, 0x52, 0x93, 0x4a, 0xae, 0x0d, 0x93, 0xaa, 0x0f, 0x5c, 0xec, 0xdc, 0xd8,
- 0x8e, 0x16, 0x86, 0x5f, 0xc8, 0x3d, 0xba, 0xb3, 0x87, 0x1f, 0x0d, 0x33, 0x7c, 0x72, 0xef, 0x8e,
- 0x14, 0x2b, 0x98, 0xd4, 0x1e, 0xba, 0x44, 0xd3, 0xc3, 0xeb, 0x73, 0xb2, 0x27, 0x42, 0x1e, 0xba,
- 0x40, 0x74, 0xb6, 0xda, 0x04, 0xce, 0xdf, 0x26, 0x38, 0xae, 0x98, 0xcc, 0x6e, 0x43, 0xbb, 0x16,
- 0xce, 0xfa, 0xfd, 0x49, 0xe1, 0x9e, 0xa8, 0x82, 0x7f, 0xa6, 0x50, 0xea, 0x79, 0x9c, 0x41, 0xf2,
- 0x31, 0x6f, 0xcd, 0xbc, 0x83, 0xae, 0xd6, 0x27, 0x56, 0x9b, 0x0c, 0xda, 0xe4, 0x69, 0xd0, 0x8e,
- 0xae, 0xfa, 0x5e, 0xbf, 0xef, 0xdd, 0x2f, 0x09, 0x97, 0x3f, 0x01, 0x9a, 0x8d, 0x07, 0x12, 0xb5,
- 0xa0, 0xdd, 0x8f, 0xa2, 0x55, 0x8d, 0xd1, 0xba, 0xc6, 0xe8, 0xb7, 0xc6, 0x68, 0xd9, 0x60, 0x67,
- 0xdd, 0x60, 0xe7, 0xbb, 0xc1, 0xce, 0xf3, 0x54, 0xa4, 0xe6, 0xad, 0x8c, 0x49, 0x02, 0x92, 0x66,
- 0x49, 0xce, 0x25, 0x7d, 0x57, 0xd5, 0x82, 0x2e, 0x76, 0xbe, 0x84, 0x9a, 0x4a, 0x71, 0x1d, 0x8f,
- 0x3a, 0xa5, 0x9b, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x15, 0xbb, 0xbc, 0x9c, 0x01, 0x00,
- 0x00,
+ // 323 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xc1, 0x4e, 0xf2, 0x40,
+ 0x1c, 0xc4, 0xbb, 0xdf, 0x97, 0x10, 0xa9, 0x9a, 0x48, 0xc5, 0xa4, 0xd6, 0xa4, 0x25, 0x3d, 0x18,
+ 0x4e, 0xbb, 0x51, 0x6f, 0x1e, 0x1b, 0x13, 0x3d, 0x1a, 0xf4, 0xe4, 0x85, 0x6c, 0x61, 0x5d, 0xab,
+ 0xdd, 0xfe, 0x37, 0xdd, 0x85, 0xd0, 0xb7, 0xe0, 0xb1, 0x38, 0x72, 0xf4, 0x84, 0x06, 0xde, 0x80,
+ 0x17, 0xd0, 0xb4, 0x5b, 0x84, 0x84, 0xdb, 0x34, 0xbf, 0x99, 0xf9, 0x4f, 0xd7, 0x76, 0x63, 0xd0,
+ 0x34, 0x2b, 0x86, 0x89, 0xd2, 0x84, 0xb3, 0x8c, 0xa9, 0x44, 0x61, 0x99, 0x83, 0x06, 0xa7, 0x65,
+ 0x08, 0xde, 0x1a, 0xbc, 0x36, 0x07, 0x0e, 0x15, 0x25, 0xa5, 0x32, 0x46, 0x2f, 0xe0, 0x00, 0x3c,
+ 0x65, 0xa4, 0xfa, 0x8a, 0x47, 0xaf, 0x44, 0x27, 0x82, 0x29, 0x4d, 0x85, 0xac, 0x0d, 0x17, 0x3b,
+ 0x37, 0xb6, 0xd2, 0xc0, 0xf0, 0x07, 0xd9, 0x47, 0xf7, 0xe6, 0xf0, 0x93, 0xa6, 0x9a, 0x39, 0x0f,
+ 0x76, 0x43, 0xd2, 0x9c, 0x0a, 0xe5, 0xa2, 0x0e, 0xea, 0x1e, 0x5e, 0x9f, 0xe3, 0xbd, 0x21, 0xf8,
+ 0xb1, 0x32, 0x44, 0x67, 0xb3, 0x45, 0x60, 0xad, 0x17, 0xc1, 0x71, 0x41, 0x45, 0x7a, 0x1b, 0x9a,
+ 0x58, 0xd8, 0xab, 0xf3, 0x4e, 0x6e, 0x9f, 0xca, 0x9c, 0x8d, 0x13, 0x18, 0xa9, 0x7e, 0x9c, 0xc2,
+ 0xe0, 0xa3, 0x5f, 0x2e, 0x73, 0xff, 0x55, 0xb5, 0x1e, 0x36, 0xb3, 0xf1, 0x66, 0x36, 0x7e, 0xde,
+ 0xcc, 0x8e, 0x2e, 0xeb, 0x5e, 0xaf, 0xee, 0xdd, 0x2f, 0x09, 0xa7, 0x5f, 0x01, 0xea, 0xb5, 0x36,
+ 0x24, 0x2a, 0x41, 0x99, 0x77, 0xae, 0xec, 0x26, 0x87, 0x71, 0x7f, 0xc8, 0x32, 0x10, 0xee, 0xff,
+ 0x0e, 0xea, 0x36, 0xa3, 0xf6, 0x7a, 0x11, 0x9c, 0x98, 0xa6, 0x3f, 0x14, 0xf6, 0x0e, 0x38, 0x8c,
+ 0xef, 0x4a, 0x19, 0x45, 0xb3, 0xa5, 0x8f, 0xe6, 0x4b, 0x1f, 0x7d, 0x2f, 0x7d, 0x34, 0x5d, 0xf9,
+ 0xd6, 0x7c, 0xe5, 0x5b, 0x9f, 0x2b, 0xdf, 0x7a, 0xe9, 0xf2, 0x44, 0xbf, 0x8d, 0x62, 0x3c, 0x00,
+ 0x41, 0xd2, 0x41, 0xc6, 0x04, 0x79, 0x97, 0xc5, 0x84, 0x4c, 0x76, 0x5e, 0x91, 0xe8, 0x42, 0x32,
+ 0x15, 0x37, 0xaa, 0xbf, 0xb8, 0xf9, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x29, 0xd1, 0x38, 0xcf,
+ 0x01, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -129,6 +139,13 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ if len(m.GovDenom) > 0 {
+ i -= len(m.GovDenom)
+ copy(dAtA[i:], m.GovDenom)
+ i = encodeVarintGenesis(dAtA, i, uint64(len(m.GovDenom)))
+ i--
+ dAtA[i] = 0x1a
+ }
n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.PreviousBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousBlockTime):])
if err1 != nil {
return 0, err1
@@ -171,6 +188,10 @@ func (m *GenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousBlockTime)
n += 1 + l + sovGenesis(uint64(l))
+ l = len(m.GovDenom)
+ if l > 0 {
+ n += 1 + l + sovGenesis(uint64(l))
+ }
return n
}
@@ -275,6 +296,38 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field GovDenom", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.GovDenom = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
diff --git a/x/botanydist/types/keys.go b/x/botanydist/types/keys.go
index ac0be4778..dd68f97ab 100644
--- a/x/botanydist/types/keys.go
+++ b/x/botanydist/types/keys.go
@@ -25,8 +25,9 @@ func KeyPrefix(p string) []byte {
}
const (
- ParamsKey = "Params-value-"
- RewardKey = "Reward-value-"
- RewardCountKey = "Reward-count-"
- PreviousBlockTime = "PreviousBlockTime"
+ ParamsKey = "Params-value-"
+ RewardKey = "Reward-value-"
+ RewardCountKey = "Reward-count-"
+ PreviousBlockTimeKey = "PreviousBlockTime"
+ GovDenomKey = "GovDenom"
)
diff --git a/x/botanydist/types/params.go b/x/botanydist/types/params.go
index d03851236..e92ffe667 100644
--- a/x/botanydist/types/params.go
+++ b/x/botanydist/types/params.go
@@ -19,7 +19,7 @@ var (
DefaultActive = false
DefaultPeriods = Periods{}
DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(1, 0))
- GovDenom = cdptypes.DefaultGovDenom
+ DefaultGovDenom = cdptypes.DefaultGovDenom
)
// NewPeriod returns a new instance of Period
diff --git a/x/incentive/genesis.go b/x/incentive/genesis.go
index 8762c8821..d85e12726 100644
--- a/x/incentive/genesis.go
+++ b/x/incentive/genesis.go
@@ -24,7 +24,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKe
for _, rp := range gs.Params.CdpMintingRewardPeriods {
_, found := cdpKeeper.GetCollateral(ctx, rp.CollateralType)
if !found {
- panic(fmt.Sprintf("jpyx minting collateral type %s not found in cdp collateral types", rp.CollateralType))
+ panic(fmt.Sprintf("cdp minting collateral type %s not found in cdp collateral types", rp.CollateralType))
}
k.SetCdpMintingRewardFactor(ctx, rp.CollateralType, sdk.ZeroDec())
}
@@ -43,17 +43,19 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKe
}
k.SetCdpMintingClaim(ctx, claim)
}
+
+ k.SetGenesisDenoms(ctx, gs.Denoms)
}
// ExportGenesis export genesis state for incentive module
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
params := k.GetParams(ctx)
- jpyxClaims := k.GetAllCdpMintingClaims(ctx)
+ cdpClaims := k.GetAllCdpMintingClaims(ctx)
synchronizedCdpClaims := types.CdpMintingClaims{}
- for _, jpyxClaim := range jpyxClaims {
+ for _, jpyxClaim := range cdpClaims {
claim, err := k.SynchronizeCdpMintingClaim(ctx, jpyxClaim)
if err != nil {
panic(err)
@@ -64,15 +66,20 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
synchronizedCdpClaims = append(synchronizedCdpClaims, claim)
}
- var jpyxMintingGats types.GenesisAccumulationTimes
+ var cdpMintingGats types.GenesisAccumulationTimes
for _, rp := range params.CdpMintingRewardPeriods {
pat, found := k.GetPreviousCdpMintingAccrualTime(ctx, rp.CollateralType)
if !found {
panic(fmt.Sprintf("expected previous jpyx minting reward accrual time to be set in state for %s", rp.CollateralType))
}
gat := types.NewGenesisAccumulationTime(rp.CollateralType, pat)
- jpyxMintingGats = append(jpyxMintingGats, gat)
+ cdpMintingGats = append(cdpMintingGats, gat)
+ }
+
+ denoms, found := k.GetGenesisDenoms(ctx)
+ if !found {
+ denoms = types.DefaultGenesisDenoms()
}
- return types.NewGenesisState(params, jpyxMintingGats, synchronizedCdpClaims)
+ return types.NewGenesisState(params, cdpMintingGats, synchronizedCdpClaims, denoms)
}
diff --git a/x/incentive/integration_test.go b/x/incentive/integration_test.go
index d23748dd2..ee39d7631 100644
--- a/x/incentive/integration_test.go
+++ b/x/incentive/integration_test.go
@@ -159,9 +159,6 @@ func NewIncentiveGenState(previousAccumTime, endTime time.Time, rewardPeriods ..
genesis := incentivetypes.NewGenesisState(
incentivetypes.NewParams(
rewardPeriods,
- incentivetypes.MultiRewardPeriods{},
- incentivetypes.MultiRewardPeriods{},
- incentivetypes.RewardPeriods{},
incentivetypes.Multipliers{
incentivetypes.NewMultiplier(incentivetypes.Small, 1, d("0.25")),
incentivetypes.NewMultiplier(incentivetypes.Large, 12, d("1.0")),
@@ -170,6 +167,7 @@ func NewIncentiveGenState(previousAccumTime, endTime time.Time, rewardPeriods ..
),
incentivetypes.DefaultGenesisAccumulationTimes,
incentivetypes.DefaultCdpClaims,
+ incentivetypes.DefaultGenesisDenoms(),
)
return app.GenesisState{incentivetypes.ModuleName: incentivetypes.ModuleCdc.MustMarshalJSON(&genesis)}
}
diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go
index dd1491a39..18925dd90 100644
--- a/x/incentive/keeper/keeper.go
+++ b/x/incentive/keeper/keeper.go
@@ -50,7 +50,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
// GetCdpMintingClaim returns the claim in the store corresponding the the input address collateral type and id and a boolean for if the claim was found
func (k Keeper) GetCdpMintingClaim(ctx sdk.Context, addr sdk.AccAddress) (types.CdpMintingClaim, bool) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.CdpMintingClaimKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey))
bz := store.Get(addr)
if bz == nil {
return types.CdpMintingClaim{}, false
@@ -62,7 +62,7 @@ func (k Keeper) GetCdpMintingClaim(ctx sdk.Context, addr sdk.AccAddress) (types.
// SetCdpMintingClaim sets the claim in the store corresponding to the input address, collateral type, and id
func (k Keeper) SetCdpMintingClaim(ctx sdk.Context, c types.CdpMintingClaim) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.CdpMintingClaimKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey))
bz := k.cdc.MustMarshalBinaryBare(&c)
store.Set(c.Owner, bz)
@@ -70,13 +70,13 @@ func (k Keeper) SetCdpMintingClaim(ctx sdk.Context, c types.CdpMintingClaim) {
// DeleteCdpMintingClaim deletes the claim in the store corresponding to the input address, collateral type, and id
func (k Keeper) DeleteCdpMintingClaim(ctx sdk.Context, owner sdk.AccAddress) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.CdpMintingClaimKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey))
store.Delete(owner)
}
// IterateCdpMintingClaims iterates over all claim objects in the store and preforms a callback function
func (k Keeper) IterateCdpMintingClaims(ctx sdk.Context, cb func(c types.CdpMintingClaim) (stop bool)) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.CdpMintingClaimKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
@@ -100,7 +100,7 @@ func (k Keeper) GetAllCdpMintingClaims(ctx sdk.Context) types.CdpMintingClaims {
// GetPreviousCdpMintingAccrualTime returns the last time a collateral type accrued Cdp minting rewards
func (k Keeper) GetPreviousCdpMintingAccrualTime(ctx sdk.Context, ctype string) (blockTime time.Time, found bool) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PreviousCdpMintingRewardAccrualTimeKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousCdpMintingRewardAccrualTimeKey))
bz := store.Get([]byte(ctype))
if bz == nil {
return time.Time{}, false
@@ -112,14 +112,14 @@ func (k Keeper) GetPreviousCdpMintingAccrualTime(ctx sdk.Context, ctype string)
// SetPreviousCdpMintingAccrualTime sets the last time a collateral type accrued Cdp minting rewards
func (k Keeper) SetPreviousCdpMintingAccrualTime(ctx sdk.Context, ctype string, blockTime time.Time) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PreviousCdpMintingRewardAccrualTimeKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousCdpMintingRewardAccrualTimeKey))
bz, _ := blockTime.MarshalBinary()
store.Set([]byte(ctype), bz)
}
// IterateCdpMintingAccrualTimes iterates over all previous Cdp minting accrual times and preforms a callback function
func (k Keeper) IterateCdpMintingAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PreviousCdpMintingRewardAccrualTimeKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousCdpMintingRewardAccrualTimeKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
@@ -135,7 +135,7 @@ func (k Keeper) IterateCdpMintingAccrualTimes(ctx sdk.Context, cb func(string, t
// GetCdpMintingRewardFactor returns the current reward factor for an individual collateral type
func (k Keeper) GetCdpMintingRewardFactor(ctx sdk.Context, ctype string) (factor sdk.Dec, found bool) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.CdpMintingRewardFactorKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingRewardFactorKey))
bz := store.Get([]byte(ctype))
if bz == nil {
return sdk.ZeroDec(), false
@@ -147,7 +147,25 @@ func (k Keeper) GetCdpMintingRewardFactor(ctx sdk.Context, ctype string) (factor
// SetCdpMintingRewardFactor sets the current reward factor for an individual collateral type
func (k Keeper) SetCdpMintingRewardFactor(ctx sdk.Context, ctype string, factor sdk.Dec) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.CdpMintingRewardFactorKeyPrefix)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingRewardFactorKey))
bz, _ := factor.Marshal()
store.Set([]byte(ctype), bz)
}
+
+func (k Keeper) GetGenesisDenoms(ctx sdk.Context) (_ *types.GenesisDenoms, found bool) {
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.KeyPrefix(types.GenesisDenomsKey))
+ if bz == nil {
+ return types.DefaultGenesisDenoms(), false
+ }
+ var denoms types.GenesisDenoms
+ denoms.Unmarshal(bz)
+
+ return &denoms, true
+}
+
+func (k Keeper) SetGenesisDenoms(ctx sdk.Context, denoms *types.GenesisDenoms) {
+ store := ctx.KVStore(k.storeKey)
+ bz, _ := denoms.Marshal()
+ store.Set(types.KeyPrefix(types.GenesisDenomsKey), bz)
+}
diff --git a/x/incentive/keeper/payout_test.go b/x/incentive/keeper/payout_test.go
index 3e0696cc3..f33e4b62e 100644
--- a/x/incentive/keeper/payout_test.go
+++ b/x/incentive/keeper/payout_test.go
@@ -89,9 +89,6 @@ func (suite *KeeperTestSuite) TestPayoutCdpMintingClaim() {
// setup incentive state
params := types.NewParams(
- types.RewardPeriods{types.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
- types.MultiRewardPeriods{types.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))},
- types.MultiRewardPeriods{types.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))},
types.RewardPeriods{types.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
tc.args.multipliers,
tc.args.initialTime.Add(time.Hour*24*365*5),
diff --git a/x/incentive/keeper/rewards.go b/x/incentive/keeper/rewards.go
index 8d9499b8e..36bb825ba 100644
--- a/x/incentive/keeper/rewards.go
+++ b/x/incentive/keeper/rewards.go
@@ -25,7 +25,10 @@ func (k Keeper) AccumulateCdpMintingRewards(ctx sdk.Context, rewardPeriod types.
k.SetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType, ctx.BlockTime())
return nil
}
- totalPrincipal := k.cdpKeeper.GetTotalPrincipal(ctx, rewardPeriod.CollateralType, types.PrincipalDenom).ToDec()
+
+ denoms, _ := k.GetGenesisDenoms(ctx)
+
+ totalPrincipal := k.cdpKeeper.GetTotalPrincipal(ctx, rewardPeriod.CollateralType, denoms.PrincipalDenom).ToDec()
if totalPrincipal.IsZero() {
k.SetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType, ctx.BlockTime())
return nil
@@ -63,8 +66,11 @@ func (k Keeper) InitializeCdpMintingClaim(ctx sdk.Context, cdp cdptypes.Cdp) {
rewardFactor = sdk.ZeroDec()
}
claim, found := k.GetCdpMintingClaim(ctx, cdp.Owner.AccAddress())
+
+ denoms, _ := k.GetGenesisDenoms(ctx)
+
if !found { // this is the owner's first jpyx minting reward claim
- claim = types.NewCdpMintingClaim(cdp.Owner.AccAddress(), sdk.NewCoin(types.CdpMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{types.NewRewardIndex(cdp.Type, rewardFactor)})
+ claim = types.NewCdpMintingClaim(cdp.Owner.AccAddress(), sdk.NewCoin(denoms.CdpMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{types.NewRewardIndex(cdp.Type, rewardFactor)})
k.SetCdpMintingClaim(ctx, claim)
return
}
@@ -92,8 +98,11 @@ func (k Keeper) SynchronizeCdpMintingReward(ctx sdk.Context, cdp cdptypes.Cdp) {
globalRewardFactor = sdk.ZeroDec()
}
claim, found := k.GetCdpMintingClaim(ctx, cdp.Owner.AccAddress())
+
+ denoms, _ := k.GetGenesisDenoms(ctx)
+
if !found {
- claim = types.NewCdpMintingClaim(cdp.Owner.AccAddress(), sdk.NewCoin(types.CdpMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{types.NewRewardIndex(cdp.Type, globalRewardFactor)})
+ claim = types.NewCdpMintingClaim(cdp.Owner.AccAddress(), sdk.NewCoin(denoms.CdpMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{types.NewRewardIndex(cdp.Type, globalRewardFactor)})
k.SetCdpMintingClaim(ctx, claim)
return
}
@@ -116,7 +125,7 @@ func (k Keeper) SynchronizeCdpMintingReward(ctx sdk.Context, cdp cdptypes.Cdp) {
k.SetCdpMintingClaim(ctx, claim)
return
}
- newRewardsCoin := sdk.NewCoin(types.CdpMintingRewardDenom, newRewardsAmount)
+ newRewardsCoin := sdk.NewCoin(denoms.CdpMintingRewardDenom, newRewardsAmount)
claim.Reward = claim.Reward.Add(newRewardsCoin)
k.SetCdpMintingClaim(ctx, claim)
return
@@ -207,7 +216,10 @@ func (k Keeper) SimulateCdpMintingSynchronization(ctx sdk.Context, claim types.C
if newRewardsAmount.IsZero() {
continue
}
- newRewardsCoin := sdk.NewCoin(types.CdpMintingRewardDenom, newRewardsAmount)
+
+ denoms, _ := k.GetGenesisDenoms(ctx)
+
+ newRewardsCoin := sdk.NewCoin(denoms.CdpMintingRewardDenom, newRewardsAmount)
claim.Reward = claim.Reward.Add(newRewardsCoin)
}
diff --git a/x/incentive/keeper/rewards_test.go b/x/incentive/keeper/rewards_test.go
index 200587df7..c00ed08c9 100644
--- a/x/incentive/keeper/rewards_test.go
+++ b/x/incentive/keeper/rewards_test.go
@@ -73,9 +73,6 @@ func (suite *KeeperTestSuite) TestAccumulateCdpMintingRewards() {
// setup incentive state
params := incentivetypes.NewParams(
- incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
- incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))},
- incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))},
incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))},
tc.args.initialTime.Add(time.Hour*24*365*5),
@@ -148,9 +145,6 @@ func (suite *KeeperTestSuite) TestSynchronizeCdpMintingReward() {
// setup incentive state
params := incentivetypes.NewParams(
- incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
- incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))},
- incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))},
incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))},
tc.args.initialTime.Add(time.Hour*24*365*5),
@@ -2741,9 +2735,6 @@ func (suite *KeeperTestSuite) TestSimulateCdpMintingRewardSynchronization() {
// setup incentive state
params := incentivetypes.NewParams(
- incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])},
- incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
- incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)},
incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])},
incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))},
tc.args.initialTime.Add(time.Hour*24*365*5),
diff --git a/x/incentive/types/claims.go b/x/incentive/types/claims.go
index 46088157e..52fe47cd6 100644
--- a/x/incentive/types/claims.go
+++ b/x/incentive/types/claims.go
@@ -11,7 +11,6 @@ import (
const (
CdpMintingClaimType = "cdp_minting"
- BondDenom = "ujsmn"
)
// Claim is an interface for handling common claim actions
diff --git a/x/incentive/types/genesis.go b/x/incentive/types/genesis.go
index 61cba18d9..a06fd82d8 100644
--- a/x/incentive/types/genesis.go
+++ b/x/incentive/types/genesis.go
@@ -18,6 +18,7 @@ func DefaultGenesis() *GenesisState {
Params: params,
CdpAccumulationTimes: GenesisAccumulationTimes{},
CdpMintingClaims: DefaultCdpClaims,
+ Denoms: DefaultGenesisDenoms(),
// this line is used by starport scaffolding # genesis/types/default
}
}
@@ -34,16 +35,20 @@ func (gs GenesisState) Validate() error {
if err := GenesisAccumulationTimes(gs.CdpAccumulationTimes).Validate(); err != nil {
return err
}
+ if err := gs.Denoms.Validate(); err != nil {
+ return err
+ }
return CdpMintingClaims(gs.CdpMintingClaims).Validate()
}
// NewGenesisState returns a new genesis state
-func NewGenesisState(params Params, jpyxAccumTimes GenesisAccumulationTimes, c CdpMintingClaims) GenesisState {
+func NewGenesisState(params Params, jpyxAccumTimes GenesisAccumulationTimes, c CdpMintingClaims, denoms *GenesisDenoms) GenesisState {
return GenesisState{
Params: params,
CdpAccumulationTimes: jpyxAccumTimes,
CdpMintingClaims: c,
+ Denoms: denoms,
}
}
@@ -87,3 +92,21 @@ func (gat GenesisAccumulationTime) Validate() error {
}
return nil
}
+
+func DefaultGenesisDenoms() *GenesisDenoms {
+ return &GenesisDenoms{
+ PrincipalDenom: DefaultPrincipalDenom,
+ CdpMintingRewardDenom: DefaultCDPMintingRewardDenom,
+ }
+}
+
+func (denoms *GenesisDenoms) Validate() error {
+ if len(denoms.PrincipalDenom) == 0 {
+ return fmt.Errorf("GovDenom is nil or empty")
+ }
+ if len(denoms.CdpMintingRewardDenom) == 0 {
+ return fmt.Errorf("GovDenom is nil or empty")
+ }
+
+ return nil
+}
diff --git a/x/incentive/types/genesis.pb.go b/x/incentive/types/genesis.pb.go
index 67017e8f5..42003a32a 100644
--- a/x/incentive/types/genesis.pb.go
+++ b/x/incentive/types/genesis.pb.go
@@ -32,6 +32,7 @@ type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"`
CdpAccumulationTimes []GenesisAccumulationTime `protobuf:"bytes,2,rep,name=cdp_accumulation_times,json=cdpAccumulationTimes,proto3" json:"cdp_accumulation_times" yaml:"cdp_accumulation_times"`
CdpMintingClaims []CdpMintingClaim `protobuf:"bytes,3,rep,name=cdp_minting_claims,json=cdpMintingClaims,proto3" json:"cdp_minting_claims" yaml:"cdp_minting_claims"`
+ Denoms *GenesisDenoms `protobuf:"bytes,4,opt,name=denoms,proto3" json:"denoms,omitempty" yaml:"denoms"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -88,6 +89,13 @@ func (m *GenesisState) GetCdpMintingClaims() []CdpMintingClaim {
return nil
}
+func (m *GenesisState) GetDenoms() *GenesisDenoms {
+ if m != nil {
+ return m.Denoms
+ }
+ return nil
+}
+
type GenesisAccumulationTime struct {
CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"`
PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time" yaml:"previous_accumulation_time"`
@@ -140,43 +148,101 @@ func (m *GenesisAccumulationTime) GetPreviousAccumulationTime() time.Time {
return time.Time{}
}
+type GenesisDenoms struct {
+ PrincipalDenom string `protobuf:"bytes,1,opt,name=principal_denom,json=principalDenom,proto3" json:"principal_denom,omitempty" yaml:"principal_denom"`
+ CdpMintingRewardDenom string `protobuf:"bytes,2,opt,name=cdp_minting_reward_denom,json=cdpMintingRewardDenom,proto3" json:"cdp_minting_reward_denom,omitempty" yaml:"principal_denom"`
+}
+
+func (m *GenesisDenoms) Reset() { *m = GenesisDenoms{} }
+func (m *GenesisDenoms) String() string { return proto.CompactTextString(m) }
+func (*GenesisDenoms) ProtoMessage() {}
+func (*GenesisDenoms) Descriptor() ([]byte, []int) {
+ return fileDescriptor_b5ea08f29a85d2f6, []int{2}
+}
+func (m *GenesisDenoms) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *GenesisDenoms) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_GenesisDenoms.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *GenesisDenoms) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_GenesisDenoms.Merge(m, src)
+}
+func (m *GenesisDenoms) XXX_Size() int {
+ return m.Size()
+}
+func (m *GenesisDenoms) XXX_DiscardUnknown() {
+ xxx_messageInfo_GenesisDenoms.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_GenesisDenoms proto.InternalMessageInfo
+
+func (m *GenesisDenoms) GetPrincipalDenom() string {
+ if m != nil {
+ return m.PrincipalDenom
+ }
+ return ""
+}
+
+func (m *GenesisDenoms) GetCdpMintingRewardDenom() string {
+ if m != nil {
+ return m.CdpMintingRewardDenom
+ }
+ return ""
+}
+
func init() {
proto.RegisterType((*GenesisState)(nil), "botany.incentive.GenesisState")
proto.RegisterType((*GenesisAccumulationTime)(nil), "botany.incentive.GenesisAccumulationTime")
+ proto.RegisterType((*GenesisDenoms)(nil), "botany.incentive.GenesisDenoms")
}
func init() { proto.RegisterFile("incentive/genesis.proto", fileDescriptor_b5ea08f29a85d2f6) }
var fileDescriptor_b5ea08f29a85d2f6 = []byte{
- // 435 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x3d, 0x6f, 0xdb, 0x30,
- 0x10, 0x35, 0x1d, 0x20, 0x40, 0x95, 0x7e, 0x04, 0x42, 0x9a, 0x28, 0x02, 0x2a, 0xc5, 0x02, 0x8a,
- 0xa6, 0x43, 0x49, 0x20, 0xdd, 0xba, 0x45, 0x1e, 0x32, 0x15, 0x28, 0x54, 0x4f, 0x5d, 0x0c, 0x9a,
- 0x66, 0x55, 0x16, 0xfc, 0x82, 0x48, 0x05, 0xd1, 0x1f, 0x68, 0xd7, 0xfc, 0xac, 0x8c, 0x19, 0x3a,
- 0x74, 0x72, 0x0b, 0x7b, 0xe9, 0x9c, 0x5f, 0x50, 0x98, 0xa2, 0xe3, 0x3a, 0xaa, 0x37, 0x4a, 0xf7,
- 0xde, 0xbd, 0x77, 0x77, 0x2f, 0x38, 0x62, 0x92, 0x50, 0x69, 0xd9, 0x25, 0x45, 0x25, 0x95, 0xd4,
- 0x30, 0x03, 0x75, 0xa5, 0xac, 0x0a, 0xf7, 0x27, 0xca, 0x62, 0xd9, 0xc0, 0xfb, 0x7a, 0x7c, 0x50,
- 0xaa, 0x52, 0xb9, 0x22, 0x5a, 0xbe, 0x5a, 0x5c, 0x9c, 0x96, 0x4a, 0x95, 0x9c, 0x22, 0xf7, 0x35,
- 0xa9, 0x3f, 0x23, 0xcb, 0x04, 0x35, 0x16, 0x0b, 0xed, 0x01, 0xc7, 0x6b, 0x85, 0xfb, 0x57, 0x5b,
- 0xca, 0x7e, 0xf4, 0x83, 0xc7, 0x17, 0xad, 0xea, 0x47, 0x8b, 0x2d, 0x0d, 0x2f, 0x82, 0x5d, 0x8d,
- 0x2b, 0x2c, 0x4c, 0x04, 0x4e, 0xc0, 0xe9, 0xde, 0x59, 0x04, 0x1f, 0xba, 0x80, 0x1f, 0x5c, 0x3d,
- 0x7f, 0x7e, 0x33, 0x4b, 0x7b, 0x77, 0xb3, 0xf4, 0x49, 0x83, 0x05, 0x7f, 0x97, 0xb5, 0xac, 0xac,
- 0xf0, 0xf4, 0xf0, 0x1b, 0x08, 0x0e, 0xc9, 0x54, 0x8f, 0x31, 0x21, 0xb5, 0xa8, 0x39, 0xb6, 0x4c,
- 0xc9, 0xb1, 0x73, 0x16, 0xf5, 0x4f, 0x76, 0x4e, 0xf7, 0xce, 0x5e, 0x77, 0x3b, 0x7b, 0x27, 0xe7,
- 0xff, 0x50, 0x46, 0x4c, 0xd0, 0xfc, 0xa5, 0x97, 0x7a, 0xd1, 0x4a, 0xfd, 0xbf, 0x6d, 0x56, 0x1c,
- 0x90, 0xa9, 0x7e, 0xc8, 0x35, 0x61, 0x15, 0x84, 0x4b, 0x82, 0x60, 0xd2, 0x32, 0x59, 0x8e, 0x09,
- 0xc7, 0x4c, 0x98, 0x68, 0xc7, 0x79, 0x18, 0x74, 0x3d, 0x0c, 0xa7, 0xfa, 0x7d, 0x0b, 0x1d, 0x2e,
- 0x91, 0xf9, 0xc0, 0x6b, 0x1f, 0xaf, 0xb5, 0x37, 0x5b, 0x65, 0xc5, 0x3e, 0xd9, 0xe4, 0x98, 0xec,
- 0x0f, 0x08, 0x8e, 0xb6, 0x0c, 0x13, 0x0e, 0x83, 0x67, 0x44, 0x71, 0x8e, 0x2d, 0xad, 0x30, 0x1f,
- 0xdb, 0x46, 0x53, 0xb7, 0xea, 0x47, 0x79, 0x7c, 0x37, 0x4b, 0x0f, 0xbd, 0xca, 0x26, 0x20, 0x2b,
- 0x9e, 0xae, 0xff, 0x8c, 0x1a, 0x4d, 0xc3, 0xef, 0x20, 0x88, 0x75, 0x45, 0x2f, 0x99, 0xaa, 0x4d,
- 0x77, 0x17, 0x51, 0xdf, 0xdd, 0x2e, 0x86, 0x6d, 0x32, 0xe0, 0x2a, 0x19, 0x70, 0xb4, 0x4a, 0x46,
- 0xfe, 0xc6, 0x8f, 0x35, 0xf0, 0xd7, 0xdb, 0xda, 0x2b, 0xbb, 0xfe, 0x95, 0x82, 0x22, 0x5a, 0x01,
- 0x3a, 0xb7, 0x39, 0xbf, 0x99, 0x27, 0xe0, 0x76, 0x9e, 0x80, 0xdf, 0xf3, 0x04, 0x5c, 0x2f, 0x92,
- 0xde, 0xed, 0x22, 0xe9, 0xfd, 0x5c, 0x24, 0xbd, 0x4f, 0xaf, 0x4a, 0x66, 0xbf, 0xd4, 0x13, 0x48,
- 0x94, 0x40, 0x9c, 0x48, 0x2a, 0xd0, 0x57, 0xdd, 0x5c, 0xa1, 0xab, 0x75, 0x08, 0xd1, 0x72, 0x38,
- 0x33, 0xd9, 0x75, 0xfe, 0xde, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x55, 0x2e, 0x87, 0x0a,
- 0x03, 0x00, 0x00,
+ // 517 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcb, 0x6e, 0xd3, 0x40,
+ 0x14, 0xcd, 0x24, 0x28, 0x12, 0x53, 0x5a, 0x8a, 0xd5, 0x87, 0x1b, 0x09, 0xbb, 0x19, 0x09, 0x51,
+ 0x16, 0xd8, 0x52, 0xd9, 0xb1, 0xab, 0x83, 0x54, 0x09, 0x09, 0x09, 0xb9, 0x59, 0xb1, 0x89, 0x26,
+ 0x93, 0xc1, 0x0c, 0xf2, 0x3c, 0xe4, 0x99, 0x94, 0xe6, 0x07, 0x60, 0xdb, 0x4f, 0x60, 0xcb, 0x9f,
+ 0x74, 0xd9, 0x25, 0xab, 0x80, 0x92, 0x0d, 0xeb, 0x7e, 0x01, 0xca, 0x78, 0x12, 0x37, 0x09, 0x11,
+ 0x3b, 0x67, 0xee, 0x39, 0xe7, 0x9e, 0x7b, 0xee, 0x0d, 0x3c, 0x64, 0x82, 0x50, 0x61, 0xd8, 0x25,
+ 0x8d, 0x33, 0x2a, 0xa8, 0x66, 0x3a, 0x52, 0x85, 0x34, 0xd2, 0xdb, 0xed, 0x4b, 0x83, 0xc5, 0x28,
+ 0x5a, 0xd4, 0x5b, 0x7b, 0x99, 0xcc, 0xa4, 0x2d, 0xc6, 0xb3, 0xaf, 0x12, 0xd7, 0x0a, 0x33, 0x29,
+ 0xb3, 0x9c, 0xc6, 0xf6, 0x57, 0x7f, 0xf8, 0x31, 0x36, 0x8c, 0x53, 0x6d, 0x30, 0x57, 0x0e, 0x70,
+ 0x54, 0x75, 0x58, 0x7c, 0x95, 0x25, 0xf4, 0xbd, 0x01, 0x1f, 0x9d, 0x97, 0x5d, 0x2f, 0x0c, 0x36,
+ 0xd4, 0x3b, 0x87, 0x4d, 0x85, 0x0b, 0xcc, 0xb5, 0x0f, 0x8e, 0xc1, 0xc9, 0xd6, 0xa9, 0x1f, 0xad,
+ 0xba, 0x88, 0xde, 0xdb, 0x7a, 0xb2, 0x7f, 0x33, 0x0e, 0x6b, 0x77, 0xe3, 0x70, 0x7b, 0x84, 0x79,
+ 0xfe, 0x1a, 0x95, 0x2c, 0x94, 0x3a, 0xba, 0xf7, 0x15, 0xc0, 0x03, 0x32, 0x50, 0x3d, 0x4c, 0xc8,
+ 0x90, 0x0f, 0x73, 0x6c, 0x98, 0x14, 0x3d, 0xeb, 0xcc, 0xaf, 0x1f, 0x37, 0x4e, 0xb6, 0x4e, 0x5f,
+ 0xac, 0x2b, 0x3b, 0x27, 0x67, 0xf7, 0x28, 0x5d, 0xc6, 0x69, 0xf2, 0xcc, 0xb5, 0x7a, 0x5a, 0xb6,
+ 0xfa, 0xb7, 0x2c, 0x4a, 0xf7, 0xc8, 0x40, 0xad, 0x72, 0xb5, 0x57, 0x40, 0x6f, 0x46, 0xe0, 0x4c,
+ 0x18, 0x26, 0xb2, 0x1e, 0xc9, 0x31, 0xe3, 0xda, 0x6f, 0x58, 0x0f, 0xed, 0x75, 0x0f, 0x9d, 0x81,
+ 0x7a, 0x57, 0x42, 0x3b, 0x33, 0x64, 0xd2, 0x76, 0xbd, 0x8f, 0xaa, 0xde, 0xcb, 0x52, 0x28, 0xdd,
+ 0x25, 0xcb, 0x1c, 0xed, 0xbd, 0x85, 0xcd, 0x01, 0x15, 0x92, 0x6b, 0xff, 0x81, 0x4d, 0x31, 0xdc,
+ 0x38, 0xeb, 0x1b, 0x0b, 0x4b, 0x9e, 0x54, 0x41, 0x96, 0x44, 0x94, 0x3a, 0x05, 0xf4, 0x07, 0xc0,
+ 0xc3, 0x0d, 0xc1, 0x78, 0x1d, 0xf8, 0x98, 0xc8, 0x3c, 0xc7, 0x86, 0x16, 0x38, 0xef, 0x99, 0x91,
+ 0xa2, 0x76, 0x6d, 0x0f, 0x93, 0xd6, 0xdd, 0x38, 0x3c, 0x70, 0x8e, 0x97, 0x01, 0x28, 0xdd, 0xa9,
+ 0x5e, 0xba, 0x23, 0x45, 0xbd, 0x6f, 0x00, 0xb6, 0x54, 0x41, 0x2f, 0x99, 0x1c, 0xea, 0xf5, 0x5c,
+ 0xfd, 0xba, 0x9d, 0xa0, 0x15, 0x95, 0x57, 0x16, 0xcd, 0xaf, 0x2c, 0xea, 0xce, 0xaf, 0x2c, 0x79,
+ 0xe9, 0x22, 0x6a, 0xbb, 0x4b, 0xd8, 0xa8, 0x85, 0xae, 0x7f, 0x85, 0x20, 0xf5, 0xe7, 0x80, 0xd5,
+ 0x71, 0xd0, 0x0f, 0x00, 0xb7, 0x97, 0x72, 0x99, 0x0d, 0xa8, 0x0a, 0x26, 0x08, 0x53, 0x38, 0xef,
+ 0xd9, 0x40, 0xd6, 0x07, 0x5c, 0x01, 0xa0, 0x74, 0x67, 0xf1, 0x62, 0x55, 0xbc, 0x0b, 0xe8, 0xdf,
+ 0x5f, 0x5b, 0x41, 0xbf, 0xe0, 0x62, 0xe0, 0xd4, 0xea, 0xff, 0x55, 0xdb, 0xaf, 0xb6, 0x9b, 0x5a,
+ 0xa6, 0x15, 0x4d, 0xce, 0x6e, 0x26, 0x01, 0xb8, 0x9d, 0x04, 0xe0, 0xf7, 0x24, 0x00, 0xd7, 0xd3,
+ 0xa0, 0x76, 0x3b, 0x0d, 0x6a, 0x3f, 0xa7, 0x41, 0xed, 0xc3, 0xf3, 0x8c, 0x99, 0x4f, 0xc3, 0x7e,
+ 0x44, 0x24, 0x8f, 0x73, 0x22, 0x28, 0x8f, 0x3f, 0xab, 0xd1, 0x55, 0x7c, 0x55, 0xfd, 0xf9, 0xe2,
+ 0xd9, 0x22, 0x74, 0xbf, 0x69, 0xb3, 0x7c, 0xf5, 0x37, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x8e, 0xdf,
+ 0xb8, 0x02, 0x04, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -199,6 +265,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ if m.Denoms != nil {
+ {
+ size, err := m.Denoms.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x22
+ }
if len(m.CdpMintingClaims) > 0 {
for iNdEx := len(m.CdpMintingClaims) - 1; iNdEx >= 0; iNdEx-- {
{
@@ -260,12 +338,12 @@ func (m *GenesisAccumulationTime) MarshalToSizedBuffer(dAtA []byte) (int, error)
_ = i
var l int
_ = l
- n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.PreviousAccumulationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousAccumulationTime):])
- if err2 != nil {
- return 0, err2
+ n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.PreviousAccumulationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousAccumulationTime):])
+ if err3 != nil {
+ return 0, err3
}
- i -= n2
- i = encodeVarintGenesis(dAtA, i, uint64(n2))
+ i -= n3
+ i = encodeVarintGenesis(dAtA, i, uint64(n3))
i--
dAtA[i] = 0x12
if len(m.CollateralType) > 0 {
@@ -278,6 +356,43 @@ func (m *GenesisAccumulationTime) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil
}
+func (m *GenesisDenoms) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *GenesisDenoms) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *GenesisDenoms) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.CdpMintingRewardDenom) > 0 {
+ i -= len(m.CdpMintingRewardDenom)
+ copy(dAtA[i:], m.CdpMintingRewardDenom)
+ i = encodeVarintGenesis(dAtA, i, uint64(len(m.CdpMintingRewardDenom)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if len(m.PrincipalDenom) > 0 {
+ i -= len(m.PrincipalDenom)
+ copy(dAtA[i:], m.PrincipalDenom)
+ i = encodeVarintGenesis(dAtA, i, uint64(len(m.PrincipalDenom)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
@@ -309,6 +424,10 @@ func (m *GenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
}
}
+ if m.Denoms != nil {
+ l = m.Denoms.Size()
+ n += 1 + l + sovGenesis(uint64(l))
+ }
return n
}
@@ -327,6 +446,23 @@ func (m *GenesisAccumulationTime) Size() (n int) {
return n
}
+func (m *GenesisDenoms) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.PrincipalDenom)
+ if l > 0 {
+ n += 1 + l + sovGenesis(uint64(l))
+ }
+ l = len(m.CdpMintingRewardDenom)
+ if l > 0 {
+ n += 1 + l + sovGenesis(uint64(l))
+ }
+ return n
+}
+
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -463,6 +599,42 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Denoms == nil {
+ m.Denoms = &GenesisDenoms{}
+ }
+ if err := m.Denoms.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
@@ -599,6 +771,120 @@ func (m *GenesisAccumulationTime) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *GenesisDenoms) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: GenesisDenoms: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: GenesisDenoms: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field PrincipalDenom", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.PrincipalDenom = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field CdpMintingRewardDenom", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.CdpMintingRewardDenom = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipGenesis(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/x/incentive/types/genesis_test.go b/x/incentive/types/genesis_test.go
index dfeb5fb48..d8337e830 100644
--- a/x/incentive/types/genesis_test.go
+++ b/x/incentive/types/genesis_test.go
@@ -17,6 +17,7 @@ func TestGenesisStateValidate(t *testing.T) {
params Params
genAccTimes GenesisAccumulationTimes
claims CdpMintingClaims
+ denoms *GenesisDenoms
}
type errArgs struct {
@@ -35,6 +36,7 @@ func TestGenesisStateValidate(t *testing.T) {
params: DefaultParams(),
genAccTimes: DefaultGenesisAccumulationTimes,
claims: DefaultCdpClaims,
+ denoms: DefaultGenesisDenoms(),
},
errArgs: errArgs{
expectPass: true,
@@ -54,9 +56,6 @@ func TestGenesisStateValidate(t *testing.T) {
sdk.NewCoin("ujsmn", sdk.NewInt(25000)),
),
},
- DefaultMultiRewardPeriods,
- DefaultMultiRewardPeriods,
- DefaultRewardPeriods,
Multipliers{
NewMultiplier(Small, 1, sdk.MustNewDecFromStr("0.33")),
},
@@ -81,6 +80,7 @@ func TestGenesisStateValidate(t *testing.T) {
},
},
},
+ denoms: DefaultGenesisDenoms(),
},
errArgs: errArgs{
expectPass: true,
@@ -123,6 +123,7 @@ func TestGenesisStateValidate(t *testing.T) {
},
},
},
+ denoms: DefaultGenesisDenoms(),
},
errArgs: errArgs{
expectPass: false,
@@ -133,7 +134,7 @@ func TestGenesisStateValidate(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
- gs := NewGenesisState(tc.args.params, tc.args.genAccTimes, tc.args.claims)
+ gs := NewGenesisState(tc.args.params, tc.args.genAccTimes, tc.args.claims, tc.args.denoms)
err := gs.Validate()
if tc.errArgs.expectPass {
require.NoError(t, err, tc.name)
diff --git a/x/incentive/types/keys.go b/x/incentive/types/keys.go
index 784079600..4c03c0786 100644
--- a/x/incentive/types/keys.go
+++ b/x/incentive/types/keys.go
@@ -22,13 +22,9 @@ func KeyPrefix(p string) []byte {
}
const (
- ParamsKey = "Params-value-"
-
- CdpMintingRewardDenom = "ujsmn"
-)
-
-var (
- CdpMintingClaimKeyPrefix = []byte{0x01} // prefix for keys that store Cdp minting claims
- CdpMintingRewardFactorKeyPrefix = []byte{0x02} // prefix for key that stores Cdp minting reward factors
- PreviousCdpMintingRewardAccrualTimeKeyPrefix = []byte{0x03} // prefix for key that stores the blocktime
+ ParamsKey = "Params-value-"
+ CdpMintingClaimKey = "CdpMintingClaim"
+ CdpMintingRewardFactorKey = "CdpMintingRewardFactorKey"
+ PreviousCdpMintingRewardAccrualTimeKey = "PreviousCdpMintingRewardAccrualTime"
+ GenesisDenomsKey = "GenesisDenoms"
)
diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go
index 90fd5f578..a0e1c85af 100644
--- a/x/incentive/types/params.go
+++ b/x/incentive/types/params.go
@@ -34,16 +34,15 @@ var (
DefaultCdpClaims = CdpMintingClaims{}
DefaultGenesisAccumulationTimes = GenesisAccumulationTimes{}
DefaultClaimEnd = tmtime.Canonical(time.Unix(1, 0))
- GovDenom = cdptypes.DefaultGovDenom
- PrincipalDenom = "jpyx"
+ DefaultPrincipalDenom = cdptypes.DefaultStableDenom
+ DefaultCDPMintingRewardDenom = cdptypes.DefaultGovDenom
IncentiveMacc = botanydistTypes.ModuleName
)
// NewParams returns a new params object
-func NewParams(jpyxMinting RewardPeriods, hardSupply, hardBorrow MultiRewardPeriods,
- hardDelegator RewardPeriods, multipliers Multipliers, claimEnd time.Time) Params {
+func NewParams(cdpMinting RewardPeriods, multipliers Multipliers, claimEnd time.Time) Params {
return Params{
- CdpMintingRewardPeriods: jpyxMinting,
+ CdpMintingRewardPeriods: cdpMinting,
ClaimMultipliers: multipliers,
ClaimEnd: claimEnd,
}
@@ -51,8 +50,7 @@ func NewParams(jpyxMinting RewardPeriods, hardSupply, hardBorrow MultiRewardPeri
// DefaultParams returns default params for incentive module
func DefaultParams() Params {
- return NewParams(DefaultRewardPeriods, DefaultMultiRewardPeriods,
- DefaultMultiRewardPeriods, DefaultRewardPeriods, DefaultMultipliers, DefaultClaimEnd)
+ return NewParams(DefaultRewardPeriods, DefaultMultipliers, DefaultClaimEnd)
}
// ParamKeyTable Key declaration for parameters
diff --git a/x/incentive/types/params_test.go b/x/incentive/types/params_test.go
index 12e80a5cd..7e2064d35 100644
--- a/x/incentive/types/params_test.go
+++ b/x/incentive/types/params_test.go
@@ -20,12 +20,9 @@ func (suite *ParamTestSuite) SetupTest() {}
func (suite *ParamTestSuite) TestParamValidation() {
type args struct {
- jpyxMintingRewardPeriods incentivetypes.RewardPeriods
- hardSupplyRewardPeriods incentivetypes.MultiRewardPeriods
- hardBorrowRewardPeriods incentivetypes.MultiRewardPeriods
- hardDelegatorRewardPeriods incentivetypes.RewardPeriods
- multipliers incentivetypes.Multipliers
- end time.Time
+ cdpMintingRewardPeriods incentivetypes.RewardPeriods
+ multipliers incentivetypes.Multipliers
+ end time.Time
}
type errArgs struct {
@@ -42,12 +39,9 @@ func (suite *ParamTestSuite) TestParamValidation() {
{
"default",
args{
- jpyxMintingRewardPeriods: incentivetypes.DefaultRewardPeriods,
- hardSupplyRewardPeriods: incentivetypes.DefaultMultiRewardPeriods,
- hardBorrowRewardPeriods: incentivetypes.DefaultMultiRewardPeriods,
- hardDelegatorRewardPeriods: incentivetypes.DefaultRewardPeriods,
- multipliers: incentivetypes.DefaultMultipliers,
- end: incentivetypes.DefaultClaimEnd,
+ cdpMintingRewardPeriods: incentivetypes.DefaultRewardPeriods,
+ multipliers: incentivetypes.DefaultMultipliers,
+ end: incentivetypes.DefaultClaimEnd,
},
errArgs{
expectPass: true,
@@ -57,9 +51,9 @@ func (suite *ParamTestSuite) TestParamValidation() {
{
"valid",
args{
- jpyxMintingRewardPeriods: incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(
+ cdpMintingRewardPeriods: incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(
true, "bnb-a", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC),
- sdk.NewCoin(incentivetypes.CdpMintingRewardDenom, sdk.NewInt(122354)))},
+ sdk.NewCoin(incentivetypes.DefaultCDPMintingRewardDenom, sdk.NewInt(122354)))},
multipliers: incentivetypes.Multipliers{
incentivetypes.NewMultiplier(
incentivetypes.Small, 1, sdk.MustNewDecFromStr("0.25"),
@@ -68,10 +62,7 @@ func (suite *ParamTestSuite) TestParamValidation() {
incentivetypes.Large, 1, sdk.MustNewDecFromStr("1.0"),
),
},
- hardSupplyRewardPeriods: incentivetypes.DefaultMultiRewardPeriods,
- hardBorrowRewardPeriods: incentivetypes.DefaultMultiRewardPeriods,
- hardDelegatorRewardPeriods: incentivetypes.DefaultRewardPeriods,
- end: time.Date(2025, 10, 15, 14, 0, 0, 0, time.UTC),
+ end: time.Date(2025, 10, 15, 14, 0, 0, 0, time.UTC),
},
errArgs{
expectPass: true,
@@ -82,9 +73,7 @@ func (suite *ParamTestSuite) TestParamValidation() {
for _, tc := range testCases {
suite.Run(tc.name, func() {
- params := incentivetypes.NewParams(tc.args.jpyxMintingRewardPeriods, tc.args.hardSupplyRewardPeriods,
- tc.args.hardBorrowRewardPeriods, tc.args.hardDelegatorRewardPeriods, tc.args.multipliers, tc.args.end,
- )
+ params := incentivetypes.NewParams(tc.args.cdpMintingRewardPeriods, tc.args.multipliers, tc.args.end)
err := params.Validate()
if tc.errArgs.expectPass {
suite.Require().NoError(err)