Skip to content

Commit

Permalink
refactor method nameing and add more to method documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Oct 13, 2023
1 parent a9785d6 commit 078b550
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions x/ibchooks/marker_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (h MarkerHooks) createNewIbcMarker(ctx sdktypes.Context, data transfertypes
allowForceTransfer,
[]string{},
)
h.adjustSupply(ctx, marker)
h.getExistingSupply(ctx, marker)
if err = ResetMarkerAccessGrants(transferAuthAddrs, marker); err != nil {
return err
}
Expand All @@ -106,8 +106,9 @@ func (h MarkerHooks) createNewIbcMarker(ctx sdktypes.Context, data transfertypes
return h.addDenomMetaData(ctx, packet, ibcKeeper, ibcDenom, data)
}

// adjustSupply updates marker account's supply, this ensures the supply is correct for ibc coins that may exist before a marker is created
func (h MarkerHooks) adjustSupply(ctx sdktypes.Context, marker *markertypes.MarkerAccount) {
// getExistingSupply updates marker account's supply, this ensures the supply is correct for ibc coins that may exist before a marker is created.
// The current circulation will be 0 if the ibc coin does not exist yet.
func (h MarkerHooks) getExistingSupply(ctx sdktypes.Context, marker *markertypes.MarkerAccount) {
currentSupply := h.MarkerKeeper.CurrentCirculation(ctx, marker)
marker.SetSupply(marker.GetSupply().Add(sdktypes.NewCoin(marker.Denom, currentSupply)))
}
Expand Down

0 comments on commit 078b550

Please sign in to comment.