Skip to content

Commit bf594b9

Browse files
authored
refactor: improvements (#26)
* M-01 * L-01 * G-01 * M-02 add clarrification note
1 parent 59eb848 commit bf594b9

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

x/tokenfactory/keeper/admins.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ func (k Keeper) setAuthorityMetadata(ctx context.Context, denom string, metadata
4040
return nil
4141
}
4242

43-
func (k Keeper) setAdmin(ctx context.Context, denom string, admin string) error {
44-
metadata, err := k.GetAuthorityMetadata(sdk.UnwrapSDKContext(ctx), denom)
45-
if err != nil {
46-
return err
47-
}
48-
43+
func (k Keeper) setAdmin(ctx context.Context, metadata types.DenomAuthorityMetadata, denom string, admin string) error {
4944
metadata.Admin = admin
5045

5146
return k.setAuthorityMetadata(ctx, denom, metadata)

x/tokenfactory/keeper/msg_server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (server msgServer) Mint(goCtx context.Context, msg *types.MsgMint) (*types.
8585
ctx.EventManager().EmitEvents(sdk.Events{
8686
sdk.NewEvent(
8787
types.TypeMsgMint,
88-
sdk.NewAttribute(types.AttributeMintToAddress, msg.Sender),
88+
sdk.NewAttribute(types.AttributeMintToAddress, msg.MintToAddress),
8989
sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()),
9090
),
9191
})
@@ -119,7 +119,7 @@ func (server msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.
119119
ctx.EventManager().EmitEvents(sdk.Events{
120120
sdk.NewEvent(
121121
types.TypeMsgBurn,
122-
sdk.NewAttribute(types.AttributeBurnFromAddress, msg.Sender),
122+
sdk.NewAttribute(types.AttributeBurnFromAddress, msg.BurnFromAddress),
123123
sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()),
124124
),
125125
})
@@ -172,7 +172,7 @@ func (server msgServer) ChangeAdmin(goCtx context.Context, msg *types.MsgChangeA
172172
return nil, types.ErrUnauthorized
173173
}
174174

175-
err = server.Keeper.setAdmin(ctx, msg.Denom, msg.NewAdmin)
175+
err = server.Keeper.setAdmin(ctx, authorityMetadata, msg.Denom, msg.NewAdmin)
176176
if err != nil {
177177
return nil, err
178178
}

x/tokenfactory/types/capabilities.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ const (
55
EnableForceTransfer = "enable_force_transfer"
66
EnableBurnFrom = "enable_burn_from"
77
// Allows addresses of your choosing to mint tokens based on specific conditions.
8-
// via the IsSudoAdminFunc
8+
// via the IsSudoAdminFunc.
9+
// NOTE: with SudoMint enabled, the sudo admin can mint `any` token, not just tokenfactory tokens.
10+
// This is intended behavior as requested by other teams, rather than having its own module with very minor logic.
11+
// If you do not wish for this behavior, write your own and do not use this capability.
912
EnableSudoMint = "enable_admin_sudo_mint"
1013
// EnableCommunityPoolFeeFunding sends tokens to the community pool when a new fee is charged (if one is set in params).
1114
// This is useful for ICS chains, or networks who wish to just have the fee tokens burned (not gas fees, just the extra on top).
@@ -14,7 +17,7 @@ const (
1417

1518
func IsCapabilityEnabled(enabledCapabilities []string, capability string) bool {
1619
if len(enabledCapabilities) == 0 {
17-
return true
20+
return false
1821
}
1922

2023
for _, v := range enabledCapabilities {

0 commit comments

Comments
 (0)