-
Notifications
You must be signed in to change notification settings - Fork 370
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
feat: Add x/precisebank module basic setup #1906
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cb5ef19
feat: Add x/precisebank module setup
drklee3 58e8e64
fix: Return nil instead of panic on genesis.Validate()
drklee3 156e9fb
test: Add precisebank testutil, genesis test setup
drklee3 5b8fd5c
Update proto docs & lint
drklee3 7bbc125
Add TestApp.GetPrecisebankKeeper()
drklee3 e713c93
fix: Import correct types in genesis_test
drklee3 643bc5e
docs: Update changelog
drklee3 274492b
docs: Add mint/burn comment note
drklee3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we add a test for this similar to the one we have in x/community?
kava/x/community/module_test.go
Lines 14 to 22 in 3c53e72