Skip to content

Commit

Permalink
Feature: constants from genesis (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Jun 1, 2024
1 parent c84877a commit e17ca42
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
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"`
}

0 comments on commit e17ca42

Please sign in to comment.