@@ -913,8 +913,8 @@ func TestTradeToFiat(t *testing.T) {
913
913
goCtx := sdk .WrapSDKContext (ctx )
914
914
server := keeper .NewMsgServer (k )
915
915
916
- // ARRANGE: Generate an admin account.
917
- admin := utils .TestAccount ()
916
+ // ARRANGE: Generate an admin and recipient account.
917
+ admin , recipient := utils . TestAccount (), utils .TestAccount ()
918
918
919
919
// ACT: Attempt to trade to fiat with an invalid signer address.
920
920
_ , err := server .TradeToFiat (goCtx , & types.MsgTradeToFiat {
@@ -936,27 +936,27 @@ func TestTradeToFiat(t *testing.T) {
936
936
// ACT: Attempt to trade to fiat with an invalid recipient address.
937
937
_ , err = server .TradeToFiat (goCtx , & types.MsgTradeToFiat {
938
938
Signer : admin .Address ,
939
- Recipient : admin .Invalid ,
939
+ Recipient : recipient .Invalid ,
940
940
})
941
941
// ASSERT: The action should've failed due to invalid recipient address.
942
942
require .ErrorContains (t , err , "unable to decode recipient address" )
943
943
944
944
// ACT: Attempt to trade to fiat with invalid recipient permissions.
945
945
_ , err = server .TradeToFiat (goCtx , & types.MsgTradeToFiat {
946
946
Signer : admin .Address ,
947
- Recipient : admin .Address ,
947
+ Recipient : recipient .Address ,
948
948
})
949
949
// ASSERT: The action should've failed due to invalid recipient permissions.
950
950
require .ErrorContains (t , err , types .ErrInvalidLiquidityProvider .Error ())
951
951
952
952
// ARRANGE: Set liquidity provider in state.
953
- k .SetUserRole (ctx , admin .Bytes , entitlements .ROLE_LIQUIDITY_PROVIDER , true )
953
+ k .SetUserRole (ctx , recipient .Bytes , entitlements .ROLE_LIQUIDITY_PROVIDER , true )
954
954
955
955
// ACT: Attempt to trade to fiat with insufficient funds.
956
956
_ , err = server .TradeToFiat (goCtx , & types.MsgTradeToFiat {
957
957
Signer : admin .Address ,
958
958
Amount : ONE ,
959
- Recipient : admin .Address ,
959
+ Recipient : recipient .Address ,
960
960
})
961
961
// ASSERT: The action should've failed due to insufficient funds.
962
962
require .ErrorContains (t , err , "insufficient funds" )
@@ -968,7 +968,7 @@ func TestTradeToFiat(t *testing.T) {
968
968
_ , err = server .TradeToFiat (goCtx , & types.MsgTradeToFiat {
969
969
Signer : admin .Address ,
970
970
Amount : sdk .NewInt (- 1_000_000 ),
971
- Recipient : admin .Address ,
971
+ Recipient : recipient .Address ,
972
972
})
973
973
// ASSERT: The action should've failed due to invalid amount.
974
974
require .ErrorContains (t , err , "invalid amount" )
@@ -977,11 +977,11 @@ func TestTradeToFiat(t *testing.T) {
977
977
_ , err = server .TradeToFiat (goCtx , & types.MsgTradeToFiat {
978
978
Signer : admin .Address ,
979
979
Amount : ONE ,
980
- Recipient : admin .Address ,
980
+ Recipient : recipient .Address ,
981
981
})
982
982
// ASSERT: The action should've succeeded.
983
983
require .NoError (t , err )
984
- require .Equal (t , ONE , bank .Balances [admin .Address ].AmountOf (k .Underlying ))
984
+ require .Equal (t , ONE , bank .Balances [recipient .Address ].AmountOf (k .Underlying ))
985
985
require .True (t , bank .Balances [types .ModuleName ].IsZero ())
986
986
}
987
987
0 commit comments