Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature: constants from genesis #20

Merged
merged 1 commit into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions pkg/indexer/genesis/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
})
}
12 changes: 11 additions & 1 deletion pkg/node/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Loading