Skip to content

Commit

Permalink
feat: add callbacks to BTT
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Grimal committed Jul 31, 2023
1 parent f21e603 commit e8cd11e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/blue_tests.tree
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@
└── it should create market

.
└── supply(Market calldata market, uint256 amount, address onBehalf) external
└── supply(Market calldata market, uint256 amount, address onBehalf, bytes calldata data) external
β”œβ”€β”€ when market is not created
β”‚ └── revert with MARKET_NOT_CREATED
└── when market is created
β”œβ”€β”€ when the amount to supply is zero
β”‚ └── revert with ZERO_AMOUNT
└── when the amount to supply is not zero
β”œβ”€β”€ if data.length > 0
β”‚ └── sender's onBlueSupply function should be called
β”œβ”€β”€ it should accrue the interests
β”œβ”€β”€ it should add amount.toSharesDown(totalSupply[id], totalSupplyShares[id]) to supplyShare[id][onBehalf]
β”œβ”€β”€ it should add amount.toSharesDown(totalSupply[id], totalSupplyShares[id]) to totalSupplyShares[id]
Expand Down Expand Up @@ -105,26 +107,30 @@
β”œβ”€β”€ it should add amount to totalBorrow[id]
└── it should transfer amount of the borrowable asset to the receiver
.
└── repay(Market memory market, uint256 amount, address onBehalf) external
└── repay(Market memory market, uint256 amount, address onBehalf, bytes calldata data) external
β”œβ”€β”€ when market is not created
β”‚ └── revert with MARKET_NOT_CREATED
└── when market is created
β”œβ”€β”€ when the amount to repay is zero
β”‚ └── revert with ZERO_AMOUNT
└── when the amount to repay is not zero
β”œβ”€β”€ if data.length > 0
β”‚ └── sender's onBlueRepayCallback function should be called
β”œβ”€β”€ it should accrue the interests
β”œβ”€β”€ it should remove amount.toSharesDown(totalBorrow[id], totalBorrowShares[id]) from borrowShare[id][onBehalf]
β”œβ”€β”€ it should remove amount.toSharesDown(totalBorrow[id], totalBorrowShares[id]) from totalBorrowShares[id],
β”œβ”€β”€ it should remove amount from totalBorrow[id]
└── it should transfer amount of the borrowable asset from the sender to Blue
.
└── supplyCollateral(Market memory market, uint256 amount, address onBehalf) external
└── supplyCollateral(Market memory market, uint256 amount, address onBehalf, bytes calldata data) external
β”œβ”€β”€ when market is not created
β”‚ └── revert with MARKET_NOT_CREATED
└── when market is created
β”œβ”€β”€ when the amount to supply is zero
β”‚ └── revert with ZERO_AMOUNT
└── when the amount to supply is not zero
β”œβ”€β”€ if data.length > 0
β”‚ └── sender's onBlueSupplyCollateral function should be called
β”œβ”€β”€ it should add amount to collateral[id][onBehalf]
└── it should transfer amount of the collateral asset from the sender to Blue
.
Expand Down Expand Up @@ -199,4 +205,4 @@
└── when fee[id] != 0
β”œβ”€β”€ it should add accruedInterests.mulWadDown(fee[id]) to feeAmount
β”œβ”€β”€ it should add feeAmount.mulDivDown(totalSupplyShares[id], totalSupply[id] - feeAmount) to supplyShare[id][feeRecipient]
└── it should add feeAmount.mulDivDown(totalSupplyShares[id], totalSupply[id] - feeAmount) to totalSupplyShares[id]
└── it should add feeAmount.mulDivDown(totalSupplyShares[id], totalSupply[id] - feeAmount) to totalSupplyShares[id]

0 comments on commit e8cd11e

Please sign in to comment.