docs: MidnightBundles (Stermi no. 14)#965
Conversation
Removed redundant authorization comments for the taker and msg.sender in multiple functions. Signed-off-by: MathisGD <74971347+MathisGD@users.noreply.github.com>
Signed-off-by: MathisGD <74971347+MathisGD@users.noreply.github.com>
| /// on Midnight. | ||
| /// @dev msg.sender is always the tokens payer (for buy, supplyCollateral and repay), and receiver is always the tokens | ||
| /// receiver (for sell and withdraw collateral). | ||
| /// @dev msg.sender must have approved the bundler to pull enough tokens. |
There was a problem hiding this comment.
same remark actually for the tokens
| /// @dev The msg.sender will pay at most maxBuyerAssets. | ||
| /// @dev Total loan assets transferred from msg.sender is | ||
| /// filledBuyerAssets + filledBuyerAssets * referralFeePct / (WAD - referralFeePct). | ||
| /// @dev The receiver will receive collateralWithdrawals[0].assets of the first collateral token of the list etc. |
There was a problem hiding this comment.
Not very clear, which list ? It's actually the following list:
[
takes[0].offer.market.collateralParams[collateralWithdrawals[0].collateralIndex).token,
takes[0].offer.market.collateralParams[collateralWithdrawals[1].collateralIndex).token,
takes[0].offer.market.collateralParams[collateralWithdrawals[2].collateralIndex).token,
...
]
| /// EXTERNAL /// | ||
|
|
||
| /// @dev The taker must have authorized this bundler and the msg.sender (if different from the taker) on Midnight. | ||
| /// @dev This function should only be called with the same market for all takes. |
There was a problem hiding this comment.
We should mention that the offers may not be all the same at the end of the Take[] array, if the amount needed is found without needing those offers: the check is in the take loop, not the collateral loop.
So someone could supply/withdraw collateral in a market not desired, if he did not check that all the markets are the same in the passed offers
| /// @dev The receiver will receive at least minSellerAssets. | ||
| /// @dev Total loan assets received by the receiver is | ||
| /// filledSellerAssets - filledSellerAssets * referralFeePct / WAD. | ||
| /// @dev msg.sender will pay collateralWithdrawals[0].assets of the first collateral token of the list etc. |
There was a problem hiding this comment.
| /// @dev msg.sender will pay collateralWithdrawals[0].assets of the first collateral token of the list etc. | |
| /// @dev msg.sender will pay collateralSupplies[0].assets of the first collateral token of the list etc. |
also not super clear syntax, would go for something like
| /// @dev msg.sender will pay collateralWithdrawals[0].assets of the first collateral token of the list etc. | |
| /// @dev msg.sender will pay all collaterals from collateralSupplies. |
| import {ConsumableUnitsLib} from "./ConsumableUnitsLib.sol"; | ||
| import {WAD} from "../libraries/ConstantsLib.sol"; | ||
|
|
||
| /// @dev buy/sell functions take min("units needed to targetUnits", takes[i].units, "consumable units") units. |
There was a problem hiding this comment.
For clarity, also just talking about target units is a bit misleading for functions that target assets
| /// @dev buy/sell functions take min("units needed to targetUnits", takes[i].units, "consumable units") units. | |
| /// @dev For each offer, the buy/sell functions will take min("units needed to fill target units / assets", takes[i].units, "units still consumable in takes[i].offer") units. |
| /// @dev The msg.sender will pay at most maxBuyerAssets. | ||
| /// @dev Total loan assets transferred from msg.sender is | ||
| /// filledBuyerAssets + filledBuyerAssets * referralFeePct / (WAD - referralFeePct). | ||
| /// @dev The receiver will receive collateralWithdrawals[0].assets of the first collateral token of the list etc. |
There was a problem hiding this comment.
| /// @dev The receiver will receive collateralWithdrawals[0].assets of the first collateral token of the list etc. | |
| /// @dev The collateralReceiver will receive collateralWithdrawals[0].assets of the first collateral token of the list etc. |
No description provided.