Skip to content

Commit

Permalink
Update types and constructors to use UsdMills rather than UsdCents.
Browse files Browse the repository at this point in the history
  • Loading branch information
Taztingo committed Jan 17, 2024
1 parent 3a6056c commit e286521
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions x/marker/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (k msgServer) AddMarker(goCtx context.Context, msg *types.MsgAddMarkerReque
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}

nav := types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, int64(msg.UsdCents)), msg.Volume)
nav := types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, int64(msg.UsdMills)), msg.Volume)
err = k.AddSetNetAssetValues(ctx, ma, []types.NetAssetValue{nav}, types.ModuleName)
if err != nil {
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
Expand Down Expand Up @@ -601,7 +601,7 @@ func (k msgServer) AddFinalizeActivateMarker(goCtx context.Context, msg *types.M
normalizedReqAttrs,
)

err = k.AddSetNetAssetValues(ctx, ma, []types.NetAssetValue{types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, int64(msg.UsdCents)), msg.Volume)}, types.ModuleName)
err = k.AddSetNetAssetValues(ctx, ma, []types.NetAssetValue{types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, int64(msg.UsdMills)), msg.Volume)}, types.ModuleName)
if err != nil {
return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions x/marker/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (s *MsgServerTestSuite) TestMsgAddMarkerRequest() {
SupplyFixed: true,
AllowGovernanceControl: true,
AllowForcedTransfer: false,
UsdCents: 1,
UsdMills: 1,
Volume: 0,
},
expErr: `cannot set net asset value : marker net asset value volume must be positive value: invalid request`,
Expand All @@ -156,7 +156,7 @@ func (s *MsgServerTestSuite) TestMsgAddMarkerRequest() {
SupplyFixed: true,
AllowGovernanceControl: true,
AllowForcedTransfer: false,
UsdCents: 1,
UsdMills: 1,
Volume: 10,
},
expEvent: []proto.Message{
Expand Down
9 changes: 5 additions & 4 deletions x/marker/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewMsgAddMarkerRequest(
allowGovernanceControl bool,
allowForcedTransfer bool,
requiredAttributes []string,
usdCentValue uint64,
usdMills uint64,
volume uint64,
) *MsgAddMarkerRequest {
return &MsgAddMarkerRequest{
Expand All @@ -65,7 +65,7 @@ func NewMsgAddMarkerRequest(
AllowGovernanceControl: allowGovernanceControl,
AllowForcedTransfer: allowForcedTransfer,
RequiredAttributes: requiredAttributes,
UsdCents: usdCentValue,
UsdMills: usdMills,
Volume: volume,
}
}
Expand Down Expand Up @@ -478,6 +478,7 @@ func (msg MsgGrantAllowanceRequest) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Administrator)}
}

// NewMsgAddFinalizeActivateMarkerRequest creates a new MsgAddFinalizeActivateMarkerRequest.
func NewMsgAddFinalizeActivateMarkerRequest(
denom string,
totalSupply sdkmath.Int,
Expand All @@ -489,7 +490,7 @@ func NewMsgAddFinalizeActivateMarkerRequest(
allowForcedTransfer bool,
requiredAttributes []string,
accessGrants []AccessGrant,
usdCentsValue uint64,
usdMills uint64,
netAssetVolume uint64,
) *MsgAddFinalizeActivateMarkerRequest {
return &MsgAddFinalizeActivateMarkerRequest{
Expand All @@ -502,7 +503,7 @@ func NewMsgAddFinalizeActivateMarkerRequest(
AccessList: accessGrants,
AllowForcedTransfer: allowForcedTransfer,
RequiredAttributes: requiredAttributes,
UsdCents: usdCentsValue,
UsdMills: usdMills,
Volume: netAssetVolume,
}
}
Expand Down

0 comments on commit e286521

Please sign in to comment.