Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: changed to new sentinel value name
Browse files Browse the repository at this point in the history
Vvaradinov committed May 15, 2023
1 parent 3552971 commit aab8b18
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/apps/transfer/types/transfer_authorization.go
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ func (a TransferAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authz.Accep
}

// If the spend limit is set to the MaxUint256 sentinel value, do not subtract the amount from the spend limit.
if allocation.SpendLimit.AmountOf(msgTransfer.Token.Denom).Equal(GetUnboundedSpendLimitSentinelValue()) {
if allocation.SpendLimit.AmountOf(msgTransfer.Token.Denom).Equal(UnboundedSpendLimit()) {
return authz.AcceptResponse{Accept: true, Delete: false, Updated: &a}, nil
}

6 changes: 3 additions & 3 deletions modules/apps/transfer/types/transfer_authorization_test.go
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ func (suite *TypesTestSuite) TestTransferAuthorizationAccept() {
{
"success: with unlimited spend limit of max uint256",
func() {
transferAuthz.Allocations[0].SpendLimit = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, types.GetUnboundedSpendLimitSentinelValue()))
transferAuthz.Allocations[0].SpendLimit = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, types.UnboundedSpendLimit()))
},
func(res authz.AcceptResponse, err error) {
suite.Require().NoError(err)
@@ -97,7 +97,7 @@ func (suite *TypesTestSuite) TestTransferAuthorizationAccept() {
suite.Require().True(ok)

remainder := updatedTransferAuthz.Allocations[0].SpendLimit.AmountOf(sdk.DefaultBondDenom)
suite.Require().True(types.GetUnboundedSpendLimitSentinelValue().Equal(remainder))
suite.Require().True(types.UnboundedSpendLimit().Equal(remainder))
},
},
{
@@ -234,7 +234,7 @@ func (suite *TypesTestSuite) TestTransferAuthorizationValidateBasic() {
{
"success: with unlimited spend limit of max uint256",
func() {
transferAuthz.Allocations[0].SpendLimit = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, types.GetUnboundedSpendLimitSentinelValue()))
transferAuthz.Allocations[0].SpendLimit = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, types.UnboundedSpendLimit()))
},
true,
},

0 comments on commit aab8b18

Please sign in to comment.