-
Notifications
You must be signed in to change notification settings - Fork 440
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
Minor tweak and test files #1356
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -o errexit -o nounset -o pipefail | ||
|
||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
|
||
echo "Compile with buildflag ''-X github.com/CosmWasm/wasmd/app.ProposalsEnabled=true' to enable gov" | ||
sleep 1 | ||
echo "## Submit a CosmWasm gov proposal" | ||
RESP=$(wasmd tx wasm submit-proposal store-instantiate "$DIR/../../x/wasm/keeper/testdata/reflect.wasm" \ | ||
'{}' --label="testing" \ | ||
--title "testing" --summary "Testing" --deposit "1000000000ustake" \ | ||
--admin $(wasmd keys show -a validator --keyring-backend=test) \ | ||
--amount 123ustake \ | ||
--keyring-backend=test \ | ||
--from validator --gas auto --gas-adjustment=1.5 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json) | ||
echo $RESP | ||
sleep 6 | ||
wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq | ||
|
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 |
---|---|---|
|
@@ -25,6 +25,10 @@ import ( | |
"github.com/CosmWasm/wasmd/x/wasm/types" | ||
) | ||
|
||
// DefaultGovAuthority is set to the gov module address. | ||
// Extension point for chains to overwrite the default | ||
var DefaultGovAuthority = sdk.AccAddress(address.Module("gov")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice to have this! Also the code looks cleaner. |
||
|
||
func SubmitProposalCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "submit-proposal", | ||
|
@@ -64,7 +68,7 @@ func ProposalStoreCodeCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
src, err := parseStoreCodeArgs(args[0], authority, cmd.Flags()) | ||
|
@@ -154,7 +158,7 @@ func ProposalInstantiateContractCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, authority, cmd.Flags()) | ||
|
@@ -201,7 +205,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
src, err := parseInstantiateArgs(args[0], args[1], clientCtx.Keyring, authority, cmd.Flags()) | ||
|
@@ -250,7 +254,7 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
src, err := parseStoreCodeArgs(args[0], authority, cmd.Flags()) | ||
|
@@ -375,7 +379,7 @@ func ProposalMigrateContractCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
src, err := parseMigrateContractArgs(args, authority) | ||
|
@@ -417,7 +421,7 @@ func ProposalExecuteContractCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
contract := args[0] | ||
|
@@ -474,7 +478,7 @@ func ProposalSudoContractCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
msg := types.MsgSudoContract{ | ||
|
@@ -517,7 +521,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
src := parseUpdateContractAdminArgs(args, authority) | ||
|
@@ -556,7 +560,7 @@ func ProposalClearContractAdminCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
msg := types.MsgClearAdmin{ | ||
|
@@ -598,7 +602,7 @@ func ProposalPinCodesCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
codeIds, err := parsePinCodesArgs(args) | ||
|
@@ -656,7 +660,7 @@ func ProposalUnpinCodesCmd() *cobra.Command { | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
codeIds, err := parsePinCodesArgs(args) | ||
|
@@ -763,7 +767,7 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1 | |
} | ||
|
||
if len(authority) == 0 { | ||
authority = sdk.AccAddress(address.Module("gov")).String() | ||
return errors.New("authority address is required") | ||
} | ||
|
||
updates, err := parseAccessConfigUpdates(args) | ||
|
@@ -803,7 +807,7 @@ func addCommonProposalFlags(cmd *cobra.Command) { | |
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") | ||
cmd.Flags().String(cli.FlagSummary, "", "Summary of proposal") | ||
cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") | ||
cmd.Flags().String(flagAuthority, "", "The address of the governance account.") | ||
cmd.Flags().String(flagAuthority, DefaultGovAuthority.String(), "The address of the governance account. Default is the sdk gov module account") | ||
} | ||
|
||
func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, error) { | ||
|
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.
Very good example 👍