Skip to content

Commit

Permalink
add Authority check
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer-zq committed Apr 15, 2024
1 parent 359c74c commit 82c1862
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/token/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,16 @@ func (m msgServer) UpdateParams(

// DeployERC20 implements v1.MsgServer.
func (m msgServer) DeployERC20(goCtx context.Context, msg *v1.MsgDeployERC20) (*v1.MsgDeployERC20Response, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if m.k.authority != msg.Authority {
return nil, errorsmod.Wrapf(
sdkerrors.ErrUnauthorized,
"invalid authority; expected %s, got %s",
m.k.authority,
msg.Authority,
)
}

ctx := sdk.UnwrapSDKContext(goCtx)
token, err := m.k.buildERC20Token(ctx, msg.Name, msg.Symbol, msg.MinUnit, msg.Scale)
if err != nil {
return nil, err
Expand Down

0 comments on commit 82c1862

Please sign in to comment.