# CauldronV4 (shared with MIM) **Possibly False Positive** ## High level idea: You liquidate yourself to farm free reward. ## Details * Do `cook` with 3 actions: 1. deposit lots of ETH (lets say worth 1M, `collatAmount` eth) 2. borrow lots of MIM (worth 0.95M, `debtAmount` MIM) 3. liquidate yourself (user = msg.sender) * While liquidating yourself, you are supposed to repay the `debtAmount` + `distributionAmount` worth of MIM, and get the `collatAmount` from the user. After doing this, the healthy check of your actions will pass. * This sounds unprofitable ```solidity! uint256 allBorrowShare = bentoBox.toShare(magicInternetMoney, allBorrowAmount, true); // Swap using a swapper freely chosen by the caller bentoBox.transfer(collateral, address(this), to, allCollateralShare); if (swapper != ISwapperV2(address(0))) { swapper.swap(address(collateral), address(magicInternetMoney), msg.sender, allBorrowShare, allCollateralShare, swapperData); // calculated again! allBorrowShare = bentoBox.toShare(magicInternetMoney, allBorrowAmount, true); bentoBox.transfer(magicInternetMoney, msg.sender, address(this), allBorrowShare); ``` `allBorrowShare` is re-calculated again after the `swap` call. and `toShare` is : ```solidity function toShare( IERC20 token, uint256 amount, bool roundUp ) external view returns (uint256 share) { share = totals[token].toBase(amount, roundUp); } function toBase( Rebase memory total, uint256 elastic, bool roundUp ) internal pure returns (uint256 base) { if (total.elastic == 0) { base = elastic; } else { base = elastic.mul(total.base) / total.elastic; if (roundUp && base.mul(total.elastic) / total.base < elastic) { base = base.add(1); } } } ```