mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00
This reverts commit b205c5ff29df25bad6b923bae327b88bdad89518. This needs to be removed so that the parameters are read from chain.
This commit is contained in:
parent
55b7065744
commit
838c887a91
108
config/config.go
108
config/config.go
@ -12,69 +12,34 @@ const DefaultConfigTemplate = `
|
||||
###############################################################################
|
||||
|
||||
[planetmint]
|
||||
asset-registry-domain = "{{ .PlmntConfig.AssetRegistryDomain }}"
|
||||
asset-registry-path = "{{ .PlmntConfig.AssetRegistryPath }}"
|
||||
asset-registry-scheme = "{{ .PlmntConfig.AssetRegistryScheme}}"
|
||||
claim-address = "{{ .PlmntConfig.ClaimAddress }}"
|
||||
claim-denom = "{{ .PlmntConfig.ClaimDenom }}"
|
||||
distribution-address-dao = "{{ .PlmntConfig.DistributionAddrDAO }}"
|
||||
distribution-address-early-inv = "{{ .PlmntConfig.DistributionAddrEarlyInv }}"
|
||||
distribution-address-investor = "{{ .PlmntConfig.DistributionAddrInvestor }}"
|
||||
distribution-address-pop = "{{ .PlmntConfig.DistributionAddrPop }}"
|
||||
distribution-address-strategic = "{{ .PlmntConfig.DistributionAddrStrategic }}"
|
||||
distribution-offset = {{ .PlmntConfig.DistributionOffset }}
|
||||
mqtt-response-timeout = {{ .PlmntConfig.MqttResponseTimeout }}
|
||||
pop-epochs = {{ .PlmntConfig.PopEpochs }}
|
||||
reissuance-asset = "{{ .PlmntConfig.ReissuanceAsset }}"
|
||||
reissuance-epochs = {{ .PlmntConfig.ReissuanceEpochs }}
|
||||
rpc-host = "{{ .PlmntConfig.RPCHost }}"
|
||||
rpc-port = {{ .PlmntConfig.RPCPort }}
|
||||
rpc-user = "{{ .PlmntConfig.RPCUser }}"
|
||||
rpc-password = "{{ .PlmntConfig.RPCPassword }}"
|
||||
rpc-scheme = "{{ .PlmntConfig.RPCScheme }}"
|
||||
rpc-wallet = "{{ .PlmntConfig.RPCWallet }}"
|
||||
staged-denom = "{{ .PlmntConfig.StagedDenom }}"
|
||||
token-denom = "{{ .PlmntConfig.TokenDenom }}"
|
||||
tx-gas-limit = {{ .PlmntConfig.TxGasLimit }}
|
||||
validator-address = "{{ .PlmntConfig.ValidatorAddress }}"
|
||||
mqtt-domain = "{{ .PlmntConfig.MqttDomain }}"
|
||||
mqtt-port = {{ .PlmntConfig.MqttPort }}
|
||||
mqtt-user = "{{ .PlmntConfig.MqttUser }}"
|
||||
mqtt-password = "{{ .PlmntConfig.MqttPassword }}"
|
||||
|
||||
`
|
||||
|
||||
// Config defines Planetmint's top level configuration
|
||||
type Config struct {
|
||||
AssetRegistryDomain string `json:"asset-registry-domain" mapstructure:"asset-registry-domain"`
|
||||
AssetRegistryPath string `json:"asset-registry-path" mapstructure:"asset-registry-path"`
|
||||
AssetRegistryScheme string `json:"asset-registry-scheme" mapstructure:"asset-registry-scheme"`
|
||||
ClaimAddress string `json:"claim-address" mapstructure:"claim-address"`
|
||||
ClaimDenom string `json:"claim-denom" mapstructure:"claim-denom"`
|
||||
ConfigRootDir string `json:"config-root-dir" mapstructure:"config-root-dir"`
|
||||
DistributionAddrDAO string `json:"distribution-addr-dao" mapstructure:"distribution-addr-dao"`
|
||||
DistributionAddrEarlyInv string `json:"distribution-addr-early-inv" mapstructure:"distribution-addr-early-inv"`
|
||||
DistributionAddrInvestor string `json:"distribution-addr-investor" mapstructure:"distribution-addr-investor"`
|
||||
DistributionAddrPop string `json:"distribution-addr-pop" mapstructure:"distribution-addr-pop"`
|
||||
DistributionAddrStrategic string `json:"distribution-addr-strategic" mapstructure:"distribution-addr-strategic"`
|
||||
DistributionOffset int `json:"distribution-offset" mapstructure:"distribution-offset"`
|
||||
MqttDomain string `json:"mqtt-domain" mapstructure:"mqtt-domain"`
|
||||
MqttPassword string `json:"mqtt-password" mapstructure:"mqtt-password"`
|
||||
MqttPort int `json:"mqtt-port" mapstructure:"mqtt-port"`
|
||||
MqttResponseTimeout int `json:"mqtt-response-timeout" mapstructure:"mqtt-response-timeout"`
|
||||
MqttUser string `json:"mqtt-user" mapstructure:"mqtt-user"`
|
||||
PopEpochs int `json:"pop-epochs" mapstructure:"pop-epochs"`
|
||||
RPCHost string `json:"rpc-host" mapstructure:"rpc-host"`
|
||||
RPCPassword string `json:"rpc-password" mapstructure:"rpc-password"`
|
||||
RPCPort int `json:"rpc-port" mapstructure:"rpc-port"`
|
||||
RPCScheme string `json:"rpc-scheme" mapstructure:"rpc-scheme"`
|
||||
RPCUser string `json:"rpc-user" mapstructure:"rpc-user"`
|
||||
RPCWallet string `json:"rpc-wallet" mapstructure:"rpc-wallet"`
|
||||
ReissuanceAsset string `json:"reissuance-asset" mapstructure:"reissuance-asset"`
|
||||
ReissuanceEpochs int `json:"reissuance-epochs" mapstructure:"reissuance-epochs"`
|
||||
StagedDenom string `json:"staged-denom" mapstructure:"staged-denom"`
|
||||
TokenDenom string `json:"token-denom" mapstructure:"token-denom"`
|
||||
TxGasLimit int `json:"tx-gas-limit" mapstructure:"tx-gas-limit"`
|
||||
ValidatorAddress string `json:"validator-address" mapstructure:"validator-address"`
|
||||
ConfigRootDir string `json:"config-root-dir" mapstructure:"config-root-dir"`
|
||||
RPCHost string `json:"rpc-host" mapstructure:"rpc-host"`
|
||||
RPCPort int `json:"rpc-port" mapstructure:"rpc-port"`
|
||||
RPCUser string `json:"rpc-user" mapstructure:"rpc-user"`
|
||||
RPCPassword string `json:"rpc-password" mapstructure:"rpc-password"`
|
||||
RPCScheme string `json:"rpc-scheme" mapstructure:"rpc-scheme"`
|
||||
RPCWallet string `json:"rpc-wallet" mapstructure:"rpc-wallet"`
|
||||
ValidatorAddress string `json:"validator-address" mapstructure:"validator-address"`
|
||||
MqttDomain string `json:"mqtt-domain" mapstructure:"mqtt-domain"`
|
||||
MqttPort int `json:"mqtt-port" mapstructure:"mqtt-port"`
|
||||
MqttUser string `json:"mqtt-user" mapstructure:"mqtt-user"`
|
||||
MqttPassword string `json:"mqtt-password" mapstructure:"mqtt-password"`
|
||||
}
|
||||
|
||||
// cosmos-sdk wide global singleton
|
||||
@ -86,43 +51,18 @@ var (
|
||||
// DefaultConfig returns planetmint's default configuration.
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
AssetRegistryDomain: "testnet-assets.rddl.io",
|
||||
AssetRegistryPath: "register_asset",
|
||||
AssetRegistryScheme: "https",
|
||||
ClaimAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx",
|
||||
ClaimDenom: "crddl",
|
||||
ConfigRootDir: "",
|
||||
DistributionAddrDAO: "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH",
|
||||
DistributionAddrEarlyInv: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
|
||||
DistributionAddrInvestor: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
|
||||
DistributionAddrPop: "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD",
|
||||
DistributionAddrStrategic: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
|
||||
// `DistributionOffset` relative to `ReissuanceEpochs`. CometBFT epochs of 5s equate 30 min (12*30)
|
||||
// to wait for confirmations on the reissuance
|
||||
DistributionOffset: 360,
|
||||
MqttDomain: "testnet-mqtt.rddl.io",
|
||||
MqttPassword: "password",
|
||||
MqttPort: 1885,
|
||||
MqttResponseTimeout: 2000, // the value is defined in milliseconds
|
||||
MqttUser: "user",
|
||||
PopEpochs: 24, // 24 CometBFT epochs of 5s equate 120s
|
||||
RPCHost: "localhost",
|
||||
RPCPassword: "password",
|
||||
RPCPort: 18884,
|
||||
RPCScheme: "http",
|
||||
RPCUser: "user",
|
||||
RPCWallet: "rpcwallet",
|
||||
ReissuanceAsset: "7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9",
|
||||
// `ReissuanceEpochs` is a configuration parameter that determines the number of CometBFT epochs
|
||||
// required for reissuance. In the context of Planetmint, reissuance refers to the process of
|
||||
// issuing new tokens. This configuration parameter specifies the number of epochs (each epoch is 5
|
||||
// seconds) that need to pass before reissuance can occur. In this case, `ReissuanceEpochs` is set
|
||||
// to 17280, which means that reissuance can occur after 1 day (12*60*24) of epochs.
|
||||
ReissuanceEpochs: 17280,
|
||||
StagedDenom: "stagedcrddl",
|
||||
TokenDenom: "plmnt",
|
||||
TxGasLimit: 200000,
|
||||
ConfigRootDir: "",
|
||||
RPCHost: "localhost",
|
||||
RPCPort: 18884,
|
||||
RPCUser: "user",
|
||||
RPCPassword: "password",
|
||||
RPCScheme: "http",
|
||||
RPCWallet: "rpcwallet",
|
||||
ValidatorAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx",
|
||||
MqttDomain: "testnet-mqtt.rddl.io",
|
||||
MqttPort: 1885,
|
||||
MqttUser: "user",
|
||||
MqttPassword: "password",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
|
||||
@ -38,10 +37,6 @@ func (s *AssetDistributionE2ETestSuite) SetupSuite() {
|
||||
daoGenState.Params.ReissuanceEpochs = s.reissaunceEpochs
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
conf := config.GetConfig()
|
||||
conf.DistributionOffset = int(s.distributionOffset)
|
||||
conf.ReissuanceEpochs = int(s.reissaunceEpochs)
|
||||
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/lib"
|
||||
"github.com/planetmint/planetmint-go/testutil"
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
@ -82,13 +81,6 @@ func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
||||
daoGenState.Params.ClaimAddress = valAddr.String()
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
conf := config.GetConfig()
|
||||
conf.PopEpochs = int(s.popEpochs)
|
||||
conf.ReissuanceEpochs = int(s.reissuanceEpochs)
|
||||
conf.DistributionOffset = int(s.distributionOffset)
|
||||
conf.MqttResponseTimeout = 200
|
||||
conf.ClaimAddress = valAddr.String()
|
||||
|
||||
s.network = network.Load(s.T(), s.cfg)
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"cosmossdk.io/math"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/lib"
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e"
|
||||
@ -81,11 +80,6 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
daoGenState.Params.ClaimAddress = valAddr.String()
|
||||
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
|
||||
|
||||
conf := config.GetConfig()
|
||||
conf.DistributionOffset = int(s.distributionOffset)
|
||||
conf.ReissuanceEpochs = int(s.reissuanceEpochs)
|
||||
conf.ClaimAddress = valAddr.String()
|
||||
|
||||
bbalances := sdk.NewCoins(
|
||||
sdk.NewCoin(daoGenState.Params.TokenDenom, math.NewInt(10000)),
|
||||
)
|
||||
|
@ -2,7 +2,6 @@ package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
@ -14,25 +13,6 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
||||
return params
|
||||
}
|
||||
k.cdc.MustUnmarshal(bz, ¶ms)
|
||||
mintAddress := params.MintAddress
|
||||
params = types.Params{
|
||||
ClaimAddress: config.GetConfig().ClaimAddress,
|
||||
ClaimDenom: config.GetConfig().ClaimDenom,
|
||||
DistributionAddressDao: config.GetConfig().DistributionAddrDAO,
|
||||
DistributionAddressEarlyInv: config.GetConfig().DistributionAddrEarlyInv,
|
||||
DistributionAddressInvestor: config.GetConfig().DistributionAddrInvestor,
|
||||
DistributionAddressPop: config.GetConfig().DistributionAddrPop,
|
||||
DistributionAddressStrategic: config.GetConfig().DistributionAddrStrategic,
|
||||
DistributionOffset: int64(config.GetConfig().DistributionOffset),
|
||||
MintAddress: mintAddress,
|
||||
MqttResponseTimeout: int64(config.GetConfig().MqttResponseTimeout),
|
||||
PopEpochs: int64(config.GetConfig().PopEpochs),
|
||||
ReissuanceAsset: config.GetConfig().ReissuanceAsset,
|
||||
ReissuanceEpochs: int64(config.GetConfig().ReissuanceEpochs),
|
||||
StagedDenom: config.GetConfig().StagedDenom,
|
||||
TokenDenom: config.GetConfig().TokenDenom,
|
||||
TxGasLimit: uint64(config.GetConfig().TxGasLimit),
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
|
@ -53,16 +53,16 @@ func DefaultParams() Params {
|
||||
"stagedcrddl",
|
||||
"crddl",
|
||||
"7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9",
|
||||
17280,
|
||||
24,
|
||||
360,
|
||||
3600,
|
||||
5,
|
||||
75,
|
||||
"vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
|
||||
"vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
|
||||
"vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
|
||||
"vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH",
|
||||
"vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD",
|
||||
2000,
|
||||
"plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx",
|
||||
"plmnt1m5apfematgm7uueazhk482026ert95x2l2dx78",
|
||||
200000)
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||
)
|
||||
|
||||
@ -14,11 +13,6 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
||||
return params
|
||||
}
|
||||
k.cdc.MustUnmarshal(bz, ¶ms)
|
||||
params = types.Params{
|
||||
AssetRegistryDomain: config.GetConfig().AssetRegistryDomain,
|
||||
AssetRegistryPath: config.GetConfig().AssetRegistryPath,
|
||||
AssetRegistryScheme: config.GetConfig().AssetRegistryScheme,
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user