-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add x/precisebank module basic setup (#1906)
- Add initial setup and empty genesis type for x/precisebank - Basic tests with mostly empty values, to be filled out with additional implementation
- Loading branch information
Showing
19 changed files
with
952 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3006,6 +3006,7 @@ | |
}, | ||
"in_flight_packets": {} | ||
}, | ||
"precisebank": {}, | ||
"pricefeed": { | ||
"params": { | ||
"markets": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
syntax = "proto3"; | ||
package kava.precisebank.v1; | ||
|
||
option go_package = "github.com/kava-labs/kava/x/precisebank/types"; | ||
|
||
// GenesisState defines the precisebank module's genesis state. | ||
message GenesisState {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# `x/precisebank` | ||
|
||
## Abstract | ||
|
||
This document specifies the precisebank module of Kava. | ||
|
||
The precisebank module is responsible for extending the precision of `x/bank`, | ||
intended to be used for the `x/evm`. It serves as a wrapper of `x/bank` to | ||
increase the precision of KAVA from 6 to 18 decimals, while preserving the | ||
behavior of existing `x/bank` balances. | ||
|
||
This module is used only by `x/evm` where 18 decimal points are expected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package precisebank | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/kava-labs/kava/x/precisebank/keeper" | ||
"github.com/kava-labs/kava/x/precisebank/types" | ||
) | ||
|
||
// InitGenesis initializes the store state from a genesis state. | ||
func InitGenesis( | ||
ctx sdk.Context, | ||
keeper keeper.Keeper, | ||
ak types.AccountKeeper, | ||
gs *types.GenesisState, | ||
) { | ||
if err := gs.Validate(); err != nil { | ||
panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) | ||
} | ||
|
||
// initialize module account | ||
if moduleAcc := ak.GetModuleAccount(ctx, types.ModuleName); moduleAcc == nil { | ||
panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) | ||
} | ||
|
||
// TODO: | ||
// - Set balances | ||
// - Ensure reserve account exists | ||
// - Ensure reserve balance matches sum of all fractional balances | ||
} | ||
|
||
// ExportGenesis returns a GenesisState for a given context and keeper. | ||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { | ||
return types.NewGenesisState() | ||
} |
Oops, something went wrong.