forked from strangelove-ventures/tokenfactory
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Sudoers stored in module's GenesisState #3
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
25ce74c
bump: CosmosSDK v0.53, IBC 10, WasmVM3
MissingNO57 acd7cac
Enable burn for any denom + tokens holder can burn
pbukva 5751eac
Cosmetic
pbukva d520ffc
feat: sudoers
MissingNO57 4a127f3
Merge branch 'main' into feat/genesis_sudoers
pbukva 9dfe23c
go mod tidy
MissingNO57 90a54b3
Safeguarding of the `Kepper.IsSudoAdminFunc` functor call
pbukva cf4ba32
Ditching redundant `Keeper.DefaultIsSudoAdminFunc` in favour of `Keep…
pbukva 17ca9b0
feat: Modularisation of the sudo admins implementation (#5)
pbukva d3546b2
Cosmetic: Rernaming store prefix key related to sudo admins
pbukva 69a3e9e
Fixing github repo url in Meakefile
pbukva 0c454ab
feath: sudoers improvements and fixes (#6)
MissingNO57 04ebde1
feat: sudo admins tests (#7)
MissingNO57 dfc1822
Refactoring tests
pbukva 7f39e9e
Cosmetic: dropping unnecessary instantion of an array
pbukva 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,47 @@ | ||
| package keeper | ||
|
|
||
| import ( | ||
| "context" | ||
| sdk "github.com/cosmos/cosmos-sdk/types" | ||
| ) | ||
|
|
||
| func (k Keeper) AddSudoAdmin(ctx context.Context, admin string) error { | ||
| sdkCtx := sdk.UnwrapSDKContext(ctx) | ||
| store := k.GetSudoAdminsStore(sdkCtx) | ||
|
|
||
| addr, err := sdk.AccAddressFromBech32(admin) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| // key = canonical address bytes | ||
| // value = dummy marker | ||
| store.Set(addr.Bytes(), []byte{1}) | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| func (k Keeper) RemoveSudoAdmin(ctx context.Context, admin string) error { | ||
| sdkCtx := sdk.UnwrapSDKContext(ctx) | ||
| store := k.GetSudoAdminsStore(sdkCtx) | ||
|
|
||
| addr, err := sdk.AccAddressFromBech32(admin) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| store.Delete(addr.Bytes()) | ||
| return nil | ||
| } | ||
|
|
||
| func (k Keeper) IsSudoAdmin(ctx context.Context, admin string) bool { | ||
| sdkCtx := sdk.UnwrapSDKContext(ctx) | ||
| store := k.GetSudoAdminsStore(sdkCtx) | ||
|
|
||
| addr, err := sdk.AccAddressFromBech32(admin) | ||
| if err != nil { | ||
| return false | ||
| } | ||
|
|
||
| return store.Has(addr.Bytes()) | ||
| } |
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.