From 408e595c615b8454c9d46959686cd056e2befbf3 Mon Sep 17 00:00:00 2001 From: Artem Date: Sat, 1 Jun 2024 11:32:10 +0200 Subject: [PATCH] Feature: constants from genesis --- pkg/indexer/genesis/constant.go | 34 +++++++++++++++++++++++++++++++-- pkg/node/types/genesis.go | 12 +++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/pkg/indexer/genesis/constant.go b/pkg/indexer/genesis/constant.go index f775655..eb0c799 100644 --- a/pkg/indexer/genesis/constant.go +++ b/pkg/indexer/genesis/constant.go @@ -60,8 +60,8 @@ func (module *Module) parseConstants(appState nodeTypes.AppState, consensus pkgT // generic data.constants = append(data.constants, storage.Constant{ Module: storageTypes.ModuleNameGeneric, - Name: "authority_sudo_key", - Value: appState.AuthoritySudoKey, + Name: "authority_sudo_address", + Value: appState.AuthoritySudoAddress, }) data.constants = append(data.constants, storage.Constant{ Module: storageTypes.ModuleNameGeneric, @@ -73,4 +73,34 @@ func (module *Module) parseConstants(appState nodeTypes.AppState, consensus pkgT Name: "ibc_sudo_address", Value: appState.IbcSudoAddress, }) + data.constants = append(data.constants, storage.Constant{ + Module: storageTypes.ModuleNameGeneric, + Name: "bridge_lock_byte_cost_multiplier", + Value: strconv.FormatInt(appState.Fees.BridgeLockByteCostMultiplier, 10), + }) + data.constants = append(data.constants, storage.Constant{ + Module: storageTypes.ModuleNameGeneric, + Name: "ics20_withdrawal_base_fee", + Value: strconv.FormatInt(appState.Fees.Ics20WithdrawalBaseFee, 10), + }) + data.constants = append(data.constants, storage.Constant{ + Module: storageTypes.ModuleNameGeneric, + Name: "init_bridge_account_base_fee", + Value: strconv.FormatInt(appState.Fees.InitBridgeAccountBaseFee, 10), + }) + data.constants = append(data.constants, storage.Constant{ + Module: storageTypes.ModuleNameGeneric, + Name: "sequence_base_fee", + Value: strconv.FormatInt(appState.Fees.SequenceBaseFee, 10), + }) + data.constants = append(data.constants, storage.Constant{ + Module: storageTypes.ModuleNameGeneric, + Name: "sequence_byte_cost_multiplier", + Value: strconv.FormatInt(appState.Fees.SequenceByteCostMultiplier, 10), + }) + data.constants = append(data.constants, storage.Constant{ + Module: storageTypes.ModuleNameGeneric, + Name: "transfer_base_fee", + Value: strconv.FormatInt(appState.Fees.TransferBaseFee, 10), + }) } diff --git a/pkg/node/types/genesis.go b/pkg/node/types/genesis.go index 44ca143..5966995 100644 --- a/pkg/node/types/genesis.go +++ b/pkg/node/types/genesis.go @@ -29,12 +29,22 @@ type Validator struct { type AppState struct { Accounts []Account `json:"accounts"` - AuthoritySudoKey string `json:"authority_sudo_key"` + AuthoritySudoAddress string `json:"authority_sudo_address"` NativeAssetBaseDenomination string `json:"native_asset_base_denomination"` IbcSudoAddress string `json:"ibc_sudo_address"` + Fees Fees `json:"fees"` } type Account struct { Address string `json:"address"` Balance json.Number `json:"balance"` } + +type Fees struct { + TransferBaseFee int64 `json:"transfer_base_fee"` + SequenceBaseFee int64 `json:"sequence_base_fee"` + SequenceByteCostMultiplier int64 `json:"sequence_byte_cost_multiplier"` + InitBridgeAccountBaseFee int64 `json:"init_bridge_account_base_fee"` + BridgeLockByteCostMultiplier int64 `json:"bridge_lock_byte_cost_multiplier"` + Ics20WithdrawalBaseFee int64 `json:"ics20_withdrawal_base_fee"` +}