Borrow, Absorb and Buy Collateral

Borrow, Absorb and Buy Collateral A sequence diagram generated by Archify. supply(WETH, amount) accrue() first, at theInterestRateModel rates.Listed asset, supply cap,assetsIn bit set, then theWETH is pulled withdraw{value: fee}(USDC, amount, priceUpdate) No borrow(): withdrawing basepast zero opens the debt. Cashcheck, principal written, thenPAUSE_BORROW and MIN_BORROW updateAndGetPrice(asset, priceUpdate) Once for USDC and once percollateral held, forwardingthe unspent msg.value getUpdateFee · updatePriceFeeds{fee} getPriceUnsafe(feedId) Reverts on a zero or staleprice, or a confidence aboveMAX_CONFIDENCE_BPS latestRoundData() Reverts on a stale anchor or aPyth deviation aboveMAX_DEVIATION_BPS price18, conf18 · fee surplus getPrice(USDC, each collateral) Debt at price + conf againstcapacity at price − conf;NotCollateralized if the debtis higher USDC (amount) · unspent msg.value absorb{value: fee}(account, priceUpdate) accrue(), then the same pricepush as the borrow, for USDCand each collateral held updateAndGetPrice(asset, priceUpdate) Same Pyth and Chainlinkpipeline getPrice(USDC, each collateral) Debt at price + conf mustexceed the liquidationcapacity at price + conf, elseNotLiquidatable getPrice(collateral) · getPrice(USDC) Seizes all collateral andcredits its mid-price value ×liquidationFactor; the debt iswiped and a shortfall is baddebt unspent msg.value buyCollateral{value: fee}(WETH, minAmount, baseAmount, recipient, priceUpdate) accrue(), then the USDC andWETH prices are pushed updateAndGetPrice(USDC) · (WETH) getPrice(WETH) · getPrice(USDC) NotForSale unless reserves <TARGET_RESERVES. The quoteuses an ask of price × (1 −storeFront × (1 − LF)) andmust reach minAmount and fitthe seized inventory WETH (quote) to recipient · unspent msg.value The buyer's USDC is pulledbefore the WETH goes out:reserves rise through cash, nosupplier is credited Borrow Absorb Buy collateral Borrower · WETH collateral · Sequence participant Borrower WETH collateral Liquidator bot · absorber and buyer · Sequence participant Liquidator bot absorber and buyer LendingMarket · singleton · Sequence participant LendingMarket singleton PythChainlinkOracle · validation pipeline · Sequence participant PythChainlinkOracle validation pipeline Pyth · pull oracle · Sequence participant Pyth pull oracle Chainlink · deviation anchor · Sequence participant Chainlink deviation anchor Legend main request return message