Skip to content

Commit

Permalink
withdraw and max withdraw tests
Browse files Browse the repository at this point in the history
  • Loading branch information
toteki committed Jun 27, 2023
1 parent 62d3297 commit 9d0421f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions x/leverage/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ func (s *IntegrationTestSuite) TestMsgWithdraw() {
// borrowed value is $10 (current) or $5 (historic)
// collateral weights are always 0.25 in testing

// create an UMEE borrower using STABLE collateral
stableUmeeBorrower := s.newAccount(coin.New(stableDenom, 100_000000))
s.supply(stableUmeeBorrower, coin.New(stableDenom, 100_000000))
s.collateralize(stableUmeeBorrower, coin.New("u/"+stableDenom, 100_000000))
s.borrow(stableUmeeBorrower, coin.New(umeeDenom, 30_000000))
// UMEE and STABLE have the same price but different collateral weights

tcs := []struct {
msg string
addr sdk.AccAddress
Expand Down Expand Up @@ -455,6 +462,14 @@ func (s *IntegrationTestSuite) TestMsgWithdraw() {
nil,
sdk.Coin{},
types.ErrUndercollaterized,
}, {
"borrow limit (undercollateralized due to borrow factor but not collateral weight)",
stableUmeeBorrower,
coin.New("u/"+stableDenom, 50_000000),
nil,
nil,
sdk.Coin{},
types.ErrUndercollaterized,
},
}

Expand Down

0 comments on commit 9d0421f

Please sign in to comment.