Skip to content

Commit

Permalink
dix: checks position
Browse files Browse the repository at this point in the history
  • Loading branch information
makcandrov committed Aug 10, 2023
1 parent d6ca6b3 commit 4304dd0
Showing 1 changed file with 23 additions and 26 deletions.
49 changes: 23 additions & 26 deletions test/blue_tests.tree
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@
│ └── revert with UNAUTHORIZED
└── when sender or approved
├── it should accrue the interests
├── when totalBorrow > totalSupply
│ └── revert with INSUFFICIENT_LIQUIDITY
└── when totalBorrow <= totalSupply
├── it should remove shares from supplyShares[market.id][onBehalf]
├── it should remove shares from totalSupplyShares[market.id]
├── it should set amount to shares.toAssetsDown(totalSupply[market.id], totalSupplyShares[market.id])
├── it should remove amount from totalSupply[market.id]
├── it should emit Withdraw(market.id, msg.sender, onBehalf, receiver, amount, shares)
└── it should transfer amount of the borrowable asset to the receiver
├── it should remove shares from supplyShares[market.id][onBehalf]
├── it should remove shares from totalSupplyShares[market.id]
├── it should set amount to shares.toAssetsDown(totalSupply[market.id], totalSupplyShares[market.id])
├── it should remove amount from totalSupply[market.id]
├── it should emit Withdraw(market.id, msg.sender, onBehalf, receiver, amount, shares)
├── it should transfer amount of the borrowable asset to the receiver
└── when totalBorrow[market.id] > totalSupply[market.id]
└── revert with INSUFFICIENT_LIQUIDITY
.
└── borrow(Market memory market, uint256 amount, address onBehalf, address receiver) external
├── when market is not created
Expand All @@ -115,18 +114,17 @@
│ └── revert with UNAUTHORIZED
└── when sender or approved
├── it should accrue the interests
├── when position not healthy
├── it should set shares to amount.toSharesUp(totalBorrow[market.id], totalBorrowShares[market.id])
├── it should add shares to borrowShares[market.id][onBehalf]
├── it should add shares to totalBorrowShares[market.id]
├── it should add amount to totalBorrow[market.id]
├── it should emit Borrow(market.id, msg.sender, onBehalf, receiver, amount, shares)
├── it should transfer amount of the borrowable asset to the receiver
├── when position is not healthy
│ └── revert with INSUFFICIENT_COLLATERAL
└── when position healthy
├── when totalBorrow > totalSupply
│ └── revert with INSUFFICIENT_LIQUIDITY
└── when totalBorrow <= totalSupply
├── it should set shares to amount.toSharesUp(totalBorrow[market.id], totalBorrowShares[market.id])
├── it should add shares to borrowShares[market.id][onBehalf]
├── it should add shares to totalBorrowShares[market.id]
├── it should add amount to totalBorrow[market.id]
├── it should emit Borrow(market.id, msg.sender, onBehalf, receiver, amount, shares)
└── it should transfer amount of the borrowable asset to the receiver
└── when position is healthy
└── when totalBorrow[market.id] > totalSupply[market.id]
└── revert with INSUFFICIENT_LIQUIDITY
.
└── repay(Market memory market, uint256 shares, address onBehalf, bytes calldata data) external
├── when market is not created
Expand Down Expand Up @@ -178,12 +176,11 @@
│ └── revert with MANAGER_NOT_APPROVED
└── when sender or approved
├── it should accrue the interests
├── when position not healthy
│ └── revert with INSUFFICIENT_COLLATERAL
└── when position healthy
├── it should remove amount from collateral[market.id][onBehalf]
├── it should emit WithdrawCollateral(market.id, msg.sender, onBehalf, receiver, amount)
└── it should transfer amount of the collateral asset to the receiver
├── it should remove amount from collateral[market.id][onBehalf]
├── it should emit WithdrawCollateral(market.id, msg.sender, onBehalf, receiver, amount)
├── it should transfer amount of the collateral asset to the receiver
└── when position is not healthy
└── revert with INSUFFICIENT_COLLATERAL
.
└── liquidate(Market memory market, address borrower, uint256 seized, bytes calldata data) external
├── when market is not created
Expand Down

0 comments on commit 4304dd0

Please sign in to comment.