Rename MsgUpdateAdministrator -> MsgUpdateAdmin
This commit is contained in:
@@ -95,7 +95,7 @@ type (
|
||||
MsgInstantiateContract = types.MsgInstantiateContract
|
||||
MsgExecuteContract = types.MsgExecuteContract
|
||||
MsgMigrateContract = types.MsgMigrateContract
|
||||
MsgUpdateAdministrator = types.MsgUpdateAdministrator
|
||||
MsgUpdateAdministrator = types.MsgUpdateAdmin
|
||||
Model = types.Model
|
||||
CodeInfo = types.CodeInfo
|
||||
ContractInfo = types.ContractInfo
|
||||
|
||||
@@ -81,7 +81,7 @@ func UpdateContractAdminCmd(cdc *codec.Codec) *cobra.Command {
|
||||
}
|
||||
}
|
||||
|
||||
msg := types.MsgUpdateAdministrator{
|
||||
msg := types.MsgUpdateAdmin{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
Contract: contractAddr,
|
||||
NewAdmin: newAdmin,
|
||||
|
||||
@@ -47,7 +47,7 @@ func setContractAdminHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
msg := types.MsgUpdateAdministrator{
|
||||
msg := types.MsgUpdateAdmin{
|
||||
Sender: cliCtx.GetFromAddress(),
|
||||
NewAdmin: req.Admin,
|
||||
Contract: contractAddress,
|
||||
|
||||
@@ -11,7 +11,7 @@ func RegisterCodec(cdc *codec.Codec) {
|
||||
cdc.RegisterConcrete(&MsgInstantiateContract{}, "wasm/instantiate", nil)
|
||||
cdc.RegisterConcrete(&MsgExecuteContract{}, "wasm/execute", nil)
|
||||
cdc.RegisterConcrete(&MsgMigrateContract{}, "wasm/migrate", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateAdministrator{}, "wasm/update-contract-admin", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateAdmin{}, "wasm/update-contract-admin", nil)
|
||||
}
|
||||
|
||||
// ModuleCdc generic sealed codec to be used throughout module
|
||||
|
||||
@@ -228,21 +228,21 @@ func (msg MsgMigrateContract) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
}
|
||||
|
||||
type MsgUpdateAdministrator struct {
|
||||
type MsgUpdateAdmin struct {
|
||||
Sender sdk.AccAddress `json:"sender" yaml:"sender"`
|
||||
NewAdmin sdk.AccAddress `json:"new_admin,omitempty" yaml:"new_admin"`
|
||||
Contract sdk.AccAddress `json:"contract" yaml:"contract"`
|
||||
}
|
||||
|
||||
func (msg MsgUpdateAdministrator) Route() string {
|
||||
func (msg MsgUpdateAdmin) Route() string {
|
||||
return RouterKey
|
||||
}
|
||||
|
||||
func (msg MsgUpdateAdministrator) Type() string {
|
||||
func (msg MsgUpdateAdmin) Type() string {
|
||||
return "update-contract-admin"
|
||||
}
|
||||
|
||||
func (msg MsgUpdateAdministrator) ValidateBasic() error {
|
||||
func (msg MsgUpdateAdmin) ValidateBasic() error {
|
||||
if err := sdk.VerifyAddressFormat(msg.Sender); err != nil {
|
||||
return sdkerrors.Wrap(err, "sender")
|
||||
}
|
||||
@@ -260,10 +260,10 @@ func (msg MsgUpdateAdministrator) ValidateBasic() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (msg MsgUpdateAdministrator) GetSignBytes() []byte {
|
||||
func (msg MsgUpdateAdmin) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))
|
||||
}
|
||||
|
||||
func (msg MsgUpdateAdministrator) GetSigners() []sdk.AccAddress {
|
||||
func (msg MsgUpdateAdmin) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.Sender}
|
||||
}
|
||||
|
||||
@@ -220,24 +220,24 @@ func TestMsgUpdateAdministrator(t *testing.T) {
|
||||
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20))
|
||||
|
||||
specs := map[string]struct {
|
||||
src MsgUpdateAdministrator
|
||||
src MsgUpdateAdmin
|
||||
expErr bool
|
||||
}{
|
||||
"all good": {
|
||||
src: MsgUpdateAdministrator{
|
||||
src: MsgUpdateAdmin{
|
||||
Sender: goodAddress,
|
||||
NewAdmin: otherGoodAddress,
|
||||
Contract: anotherGoodAddress,
|
||||
},
|
||||
},
|
||||
"new admin optional": {
|
||||
src: MsgUpdateAdministrator{
|
||||
src: MsgUpdateAdmin{
|
||||
Sender: goodAddress,
|
||||
Contract: anotherGoodAddress,
|
||||
},
|
||||
},
|
||||
"bad sender": {
|
||||
src: MsgUpdateAdministrator{
|
||||
src: MsgUpdateAdmin{
|
||||
Sender: badAddress,
|
||||
NewAdmin: otherGoodAddress,
|
||||
Contract: anotherGoodAddress,
|
||||
@@ -245,7 +245,7 @@ func TestMsgUpdateAdministrator(t *testing.T) {
|
||||
expErr: true,
|
||||
},
|
||||
"bad new admin": {
|
||||
src: MsgUpdateAdministrator{
|
||||
src: MsgUpdateAdmin{
|
||||
Sender: goodAddress,
|
||||
NewAdmin: badAddress,
|
||||
Contract: anotherGoodAddress,
|
||||
@@ -253,7 +253,7 @@ func TestMsgUpdateAdministrator(t *testing.T) {
|
||||
expErr: true,
|
||||
},
|
||||
"bad contract addr": {
|
||||
src: MsgUpdateAdministrator{
|
||||
src: MsgUpdateAdmin{
|
||||
Sender: goodAddress,
|
||||
NewAdmin: otherGoodAddress,
|
||||
Contract: badAddress,
|
||||
@@ -261,7 +261,7 @@ func TestMsgUpdateAdministrator(t *testing.T) {
|
||||
expErr: true,
|
||||
},
|
||||
"new admin same as old admin": {
|
||||
src: MsgUpdateAdministrator{
|
||||
src: MsgUpdateAdmin{
|
||||
Sender: goodAddress,
|
||||
NewAdmin: goodAddress,
|
||||
Contract: anotherGoodAddress,
|
||||
|
||||
Reference in New Issue
Block a user