Verified contractExactUNLICENSED
FLAMMBlindLib
Address0x0b8d436f1a7ae25c5d16955ed4cda781e42e7e5c
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.35
- Same code
Only this contract
Details
- Compiler
- solc 0.8.35+commit.47b9dedd
- Language
- solidity
- Optimization
- Yes, 100 runs
- EVM version
- cancun
- Via IR
- yes
- License
- UNLICENSED
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,396,514
- Creation transaction
- 0x7628489798…97327a8cba
- Libraries
- src/core/mm/MMRouterLib.sol:MMRouterLib0xa474…d2b4e5src/core/flamm/FLAMMLane.sol:FLAMMLane0x0988…d22e98src/core/flamm/FLAMMRoute.sol:FLAMMRoute0x312e…0fdaa9src/periphery/FLAMMMaxima.sol:FLAMMMaxima0x4a99…d6259csrc/core/flamm/FLAMMLawLib.sol:FLAMMLawLib0x5d47…27cc62src/core/flamm/FLAMMOpsLib.sol:FLAMMOpsLib0x0bfe…043753src/core/mm/AaveV3ReadsLib.sol:AaveV3ReadsLib0xd53f…ed5983src/core/flamm/FLAMMFlowLib.sol:FLAMMFlowLib0x2577…4e3473src/core/flamm/FLAMMGateLib.sol:FLAMMGateLib0xf0be…2b9555src/core/flamm/FLAMMKeptLib.sol:FLAMMKeptLib0x7a11…58517bsrc/core/mm/CTokenMarketLib.sol:CTokenMarketLib0x18c5…b2071csrc/core/flamm/FLAMMAdmitLib.sol:FLAMMAdmitLib0xa6db…bdcbcbsrc/core/flamm/FLAMMBlindLib.sol:FLAMMBlindLib0x0b8d…2e7e5csrc/core/flamm/FLAMMClaimLib.sol:FLAMMClaimLib0x02b4…731ccesrc/core/flamm/FLAMMFenceLib.sol:FLAMMFenceLib0xa16d…a201e8src/core/flamm/FLAMMFloatLib.sol:FLAMMFloatLib0x539e…a79737src/core/flamm/FLAMMQuoteLib.sol:FLAMMQuoteLib0xa4d3…d5ce2esrc/core/flamm/FLAMMTopUpLib.sol:FLAMMTopUpLib0x7c55…d233dfsrc/core/mm/CTokenRewardsLib.sol:CTokenRewardsLib0xcda6…a4dcf7src/core/mm/MMRouterAdminLib.sol:MMRouterAdminLib0x8423…7adc96src/core/flamm/FLAMMPolicyLib.sol:FLAMMPolicyLib0xa6b4…0c67f9src/core/flamm/FLAMMSettleLib.sol:FLAMMSettleLib0xb489…d3c7cbsrc/core/flamm/FLAMMSharedLib.sol:FLAMMSharedLib0xfaae…2511basrc/periphery/FLAMMExitMaxima.sol:FLAMMExitMaxima0x480f…4e0a81src/hooks/everlong/LeverageLib.sol:LeverageLib0x1b1d…40ad11src/core/flamm/FLAMMMaintainLib.sol:FLAMMMaintainLib0x9499…409cc2src/core/flamm/FLAMMPairQuoteLib.sol:FLAMMPairQuoteLib0x0775…d94cbesrc/hooks/everlong/EverlongOpsLib.sol:EverlongOpsLib0xabe4…7426f7
52 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/core/flamm/FLAMMBlindLib.solmain41.3 KB
- lib/openzeppelin-contracts-compat/contracts/interfaces/draft-IERC6093.sol6.54 KB
- lib/openzeppelin-contracts-compat/contracts/token/ERC20/IERC20.sol2.77 KB
- lib/openzeppelin-contracts-compat/contracts/token/ERC20/extensions/IERC20Metadata.sol683 B
- lib/openzeppelin-contracts-compat/contracts/utils/math/Math.sol12.51 KB
- lib/openzeppelin-contracts-compat/contracts/utils/math/SafeCast.sol35.08 KB
- lib/openzeppelin-contracts-upgradeable-compat/contracts/proxy/utils/Initializable.sol8.91 KB
- lib/openzeppelin-contracts-upgradeable-compat/contracts/token/ERC20/ERC20Upgradeable.sol12.23 KB
- lib/openzeppelin-contracts-upgradeable-compat/contracts/utils/ContextUpgradeable.sol1.19 KB
- src/core/PriceFeed.sol19.12 KB
- src/core/flamm/FLAMM.sol54.32 KB
- src/core/flamm/FLAMMAdmitLib.sol37.26 KB
- src/core/flamm/FLAMMClaimLib.sol49.42 KB
- src/core/flamm/FLAMMClaimVault.sol1.65 KB
- src/core/flamm/FLAMMFenceLib.sol72.83 KB
- src/core/flamm/FLAMMFloatLib.sol57.91 KB
- src/core/flamm/FLAMMFlowLib.sol55.24 KB
- src/core/flamm/FLAMMGateLib.sol87.39 KB
- src/core/flamm/FLAMMKeptLib.sol45.59 KB
- src/core/flamm/FLAMMLane.sol70.27 KB
- src/core/flamm/FLAMMLawLib.sol60.67 KB
- src/core/flamm/FLAMMMaintainLib.sol41.67 KB
- src/core/flamm/FLAMMOpsLib.sol32.2 KB
- src/core/flamm/FLAMMPolicyLib.sol39.49 KB
- src/core/flamm/FLAMMQuoteLib.sol16.89 KB
- src/core/flamm/FLAMMRoute.sol16.45 KB
- src/core/flamm/FLAMMSettleLib.sol42.92 KB
- src/core/flamm/FLAMMSharedLib.sol13.11 KB
- src/core/flamm/FLAMMStore.sol135.42 KB
- src/core/flamm/FLAMMSwapLib.sol55.65 KB
- src/core/flamm/FLAMMTopUpLib.sol48.97 KB
- src/core/mm/MMRouterAdminLib.sol24.07 KB
- src/core/mm/MMRouterLib.sol72.71 KB
- src/core/mm/VenueAccountBase.sol15.61 KB
- src/core/mm/VenueReads.sol2.05 KB
- src/interfaces/core/IDepositAllowlist.sol1.06 KB
- src/interfaces/core/IEverlongCore.sol889 B
- src/interfaces/core/IPriceFeed.sol3.71 KB
- src/interfaces/core/flamm/IFLAMM.sol52.68 KB
- src/interfaces/core/flamm/IFLAMMHooks.sol8.36 KB
- src/interfaces/core/flamm/IHookCapabilities.sol2.63 KB
- src/interfaces/core/flamm/IPairHook.sol14.14 KB
- src/interfaces/core/mm/IAccountDeployer.sol2.99 KB
- src/interfaces/core/mm/IFinancingAccount.sol46.04 KB
- src/interfaces/core/mm/IHeldRepay.sol2.61 KB
- src/interfaces/core/mm/IMMRouter.sol70.37 KB
- src/interfaces/utils/integrations/IAggregatorV3Interface.sol818 B
- src/libraries/Constants.sol2.11 KB
- src/libraries/DelayLib.sol11.22 KB
- src/libraries/ReentrancyGuardLib.sol2.52 KB
- src/libraries/SafeTransferLib.sol5.11 KB
- src/propamm/libraries/PropAMMLaneLib.sol2.31 KB
src/core/flamm/FLAMMBlindLib.sol
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2025-2026 Everlong Labs Limited
pragma solidity ^0.8.26;
import {
FLAMMStore, Paused, InvalidConfig, PegBroken, LedgerBoundBreached, PriceUnchecked, BufferRefilled, CircularBook,
WAD, GuardianMayOnlyTighten, IdleFloorSet, CustodyBlindSet, CreditPathSet, VenueReportsLoss
} from "src/core/flamm/FLAMMStore.sol";
import {FLAMMGateLib} from "src/core/flamm/FLAMMGateLib.sol";
import {FLAMMLawLib} from "src/core/flamm/FLAMMLawLib.sol";
import {FLAMMLane} from "src/core/flamm/FLAMMLane.sol";
import {FLAMMTopUpLib} from "src/core/flamm/FLAMMTopUpLib.sol";
import {FLAMMKeptLib} from "src/core/flamm/FLAMMKeptLib.sol";
import {IMMRouter} from "src/interfaces/core/mm/IMMRouter.sol";
import {
IFinancingAccount, CAP_ACCRUING_COLLATERAL, CAP_MUTABLE_THRESHOLD
} from "src/interfaces/core/mm/IFinancingAccount.sol";
import {ReentrancyGuardLib} from "src/libraries/ReentrancyGuardLib.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
/// @notice A custody-blind pool's buffer (`FLAMMStore.CUSTODY_BLIND`): the refill, which borrows each venue's
/// debt token into custody ({refillBuffer}, `FLAMMFloatLib.refill`'s body), the gate a refill and a release
/// pass ({blindGate}, `FLAMMMaintainLib.maintain`'s release), what a flush may repay ({repayable}, the trigger
/// read under which anyone's flush repays below the reserve target among it) and the idle floor's setter
/// ({setIdleFloor}), the last two the bodies of `FLAMMFloatLib`'s entries, out of that library so it keeps its
/// room. The gate reads no custody: each venue as its lender
/// reports it and the credit law per backing token on the book with no custody and no supply, so a cheap fill,
/// which moves custody alone, moves nothing it reads. A linked library the pool's own libraries delegate to
/// with its storage as an argument, so no other caller reaches it (no fallback routes here), out of the cheap
/// lane's library, whose code the swap path runs.
library FLAMMBlindLib {
/// @dev The idle floor's key in the pending table: `FLAMMFloatLib.setIdleFloor`'s selector, the entry's own, so a
/// scheduled cut reads as the curator made it.
bytes4 private constant SET_IDLE_FLOOR = bytes4(keccak256("setIdleFloor(uint128)"));
/// @dev A venue's lack under this share of what it posts takes no part of the law's shortfall ({_plan}): the dust a
/// venue at its pin gathers between refills as its debt accrues, which the refill's own venue posts instead.
uint256 private constant DUST_WAD = 1e15;
/// @notice `FLAMMFloatLib.initLaneTokens`'s custody-blind birth, out of that library so it keeps its room: sets the
/// law for the pool's life (`FLAMMStore.CUSTODY_BLIND`) and turns the credit path off for good. Refused
/// (`InvalidConfig`) where a live venue sits at a frame's account (no collateral token, `FRAME_VENUE` in
/// `IMMRouter.sol`), whose venues share one lender position while the gate holds each venue to its own
/// health ({blindGate}): the genesis venues are admitted before the law is set, out of reach of the blind
/// admission's refusal (`FLAMMAdmitLib._markAdmitted`), so the birth reads them.
function birth(FLAMMStore.S storage $) public {
uint256 live;
for (uint256 q; q < $.pairCount; ++q) {
live |= $.pairs[q].venues;
}
IMMRouter r = $.router;
for (uint256 i; live >> i != 0; ++i) {
if ((live >> i) & 1 == 0) continue;
IMMRouter.VenueView memory v = r.venue(address(this), uint16(i));
if (IFinancingAccount(v.account).COLLATERAL_ASSET() == address(0)) revert InvalidConfig();
}
$.features |= uint16(FLAMMStore.CUSTODY_BLIND);
uint256 cfg = $.laneConfig;
if (cfg & FLAMMStore.LANE_CREDIT_OFF == 0) {
$.laneConfig = cfg | FLAMMStore.LANE_CREDIT_OFF;
emit CreditPathSet(false);
}
emit CustodyBlindSet();
}
/// @notice `FLAMMFloatLib.refill`'s body, out of its library, under the caller's checks and lock: on a
/// custody-blind pool (`FLAMMStore.CUSTODY_BLIND`), borrows `amounts[i]` at venue `ids[i]` into custody,
/// each venue's own debt token, through the Router's borrow at that venue (`IMMRouter.borrow`, with all of
/// its checks: switches, drawn set, band, pin, caps, rate), posting first what its pin needs for its debt
/// and the draw read back a few units high (`FLAMMGateLib.READ_BACK_UNITS`), and nothing where what it
/// posts already covers it. Returns what it posted.
/// @dev - One read of the venues and their prices serves every draw and the gate after them ({_walk}, {_plan}):
/// each indebted venue past its trigger takes its own lack to its target, and what the law per token still
/// lacks at the draws' collateral token goes to the venues that lack it, most in need first, the rest at the
/// first draw's venue.
/// - Every draw posts one collateral token, and all of the posts come out of at most `maxPost` of the custody
/// the pool owns of it.
/// - Refused (`LedgerBoundBreached`) while the pool asset's custody the pool owns sits under its idle floor
/// after the post (`FLAMMStore.S.idleFloor`: the asks' inventory, so a drain the refills run through leaves
/// the asks that repay; zero: no refill, `InvalidConfig`), a state check that a top-up made ahead does not
/// step around, though a top-up, an entry and the maintainer are not bound by it.
/// - The venues it posted or drew at are read again after, and both rules hold on what their lenders report.
/// - Refused (`InvalidConfig`) where the custody the pool owns of a drawn token after it passes the token's
/// reserve target, the guard that keeps a stranger's flush off the buffer (`FLAMMFloatLib.flush`): the
/// curator sets each borrowed token's target to the buffer it keeps, counting all the custody the pool owns
/// of the token, a curator's seed included (the first draw is the target less what custody already holds),
/// and a target left at zero takes no refill.
/// - The curator also holds each pair's debt cap tight (`FLAMMPolicyLib.setPairCaps`: one to two buffers, each at most
/// about a tenth of the book), the bound on what refills borrow over a drain.
/// - Refused (`VenueReportsLoss`) where it would post at a venue whose lender reports a loss on its collateral
/// of `FLAMMStore.LOSS_MOVE_FLOOR` or more, or takes a redemption fee of any size on it ({_requireNoLoss}).
/// Only a venue it posts at is read: a draw at a fee venue whose collateral already covers it, so that it
/// needs no new post, still lands. That reaches the keeper's and the operator's refill on a custody-blind
/// pool alone, and a repay of that venue's whole debt cures it.
/// - It needs the pool unpaused; each venue live and unfenced, of a live pair that borrows, both of its tokens
/// on peg, as a swap's draw needs. Each drawn token's flag and each pair's proof are cleared before its
/// draw, so strict mode's rule reads no stale proof.
function refillBuffer(FLAMMStore.S storage $, uint16[] memory ids, uint256[] memory amounts, uint256 maxPost)
public
returns (uint256 put)
{
uint256 n = ids.length;
if ($.features & FLAMMStore.CUSTODY_BLIND == 0 || n == 0 || amounts.length != n) revert InvalidConfig();
if ($.paused) revert Paused();
uint256 floor = $.idleFloor;
if (floor == 0) revert InvalidConfig();
FLAMMGateLib.Book memory b = _prices($);
uint256 draws = _draws($, ids);
(VenueRead[] memory rd, uint256[] memory posted, uint256[] memory owed) = _walk($, b, draws);
uint256[] memory post = new uint256[](rd.length);
uint256 x = _drawPlan($, b, rd, post, posted, owed, ids, amounts);
put = _plan($, b, rd, post, posted, owed, x, ids[0]);
if (put > _budget($, x, maxPost)) revert LedgerBoundBreached();
if (put != 0) {
_requireNoLoss($, rd, post);
_postAt($, rd, post, x, put);
}
// the floor is a state, read after the refill's own post: a top-up ahead does not step around it
if (FLAMMStore.ownHeld($, 0) < floor) revert LedgerBoundBreached();
uint256 moved = _borrowAll($, rd, post, ids, amounts, b.usd) | (uint256(1) << x);
_reread($, rd, post, posted, owed, draws);
if (_shortfall($, b, posted, owed, FLAMMLawLib.NONE) != 0) revert LedgerBoundBreached();
// the tokens it moved alone: the collateral it posted and each it drew
FLAMMStore.reconcileMoved($, moved, 0, 0);
}
/// @dev The draws' venue slots as a mask, each once and none retired (`InvalidConfig`), woken first: a draw opens a
/// position there.
function _draws(FLAMMStore.S storage $, uint16[] memory ids) private returns (uint256 draws) {
for (uint256 i; i < ids.length; ++i) {
uint256 bit = uint256(1) << ids[i];
if (draws & bit != 0 || ids[i] >= FLAMMStore.MAX_POOL_VENUES) revert InvalidConfig();
draws |= bit;
}
if (draws & $.retiredVenues != 0) revert InvalidConfig();
FLAMMGateLib.wake($, draws);
}
/// @dev Each draw on the walk's read: its venue read and unfenced, its pair live and borrowing, one collateral
/// token for every draw (`InvalidConfig` otherwise), both of its pair's tokens on peg (`PegBroken`); its debt
/// token's flag and its pair's proof cleared; its venue's debt raised by the draw read back high, and what its
/// pin then needs past what it posts planned there (`post`, padded where collateral accrues; `posted` and the
/// read take it unpadded). Returns the collateral token.
function _drawPlan(
FLAMMStore.S storage $,
FLAMMGateLib.Book memory b,
VenueRead[] memory rd,
uint256[] memory post,
uint256[] memory posted,
uint256[] memory owed,
uint16[] memory ids,
uint256[] memory amounts
) private returns (uint256 x) {
x = FLAMMLawLib.NONE;
for (uint256 i; i < ids.length; ++i) {
uint256 k = _slotOf(rd, ids[i]);
if (k == rd.length || amounts[i] == 0) revert InvalidConfig();
VenueRead memory v = rd[k];
FLAMMStore.PairCfg storage pc = $.pairs[v.pair];
uint256 y = pc.debt;
if (!pc.live || pc.borrowOff || (x != FLAMMLawLib.NONE && v.coll != x)) revert InvalidConfig();
// the collateral token's peg once, at the first draw, each debt token's at its own
if (x == FLAMMLawLib.NONE && !FLAMMGateLib.onPeg($, FLAMMStore.tokenOf($, v.coll), b.usd[v.coll])) {
revert PegBroken();
}
x = v.coll;
if (!FLAMMGateLib.onPeg($, FLAMMStore.tokenOf($, y), b.usd[y])) revert PegBroken();
FLAMMStore.TokenCfg storage cy = $.tokens[y];
if (cy.debtFree) cy.debtFree = false;
FLAMMGateLib.drawAt($, v.pair);
uint256 d = amounts[i] + FLAMMGateLib.READ_BACK_UNITS;
(v.d, owed[v.pair]) = (v.d + d, owed[v.pair] + d);
uint256 need = FLAMMGateLib.requiredPosted(v.d, pc.ltvWad, v.price);
if (need <= v.c) continue;
uint256 l = need - v.c;
(post[k], posted[x], v.c) = (post[k] + l + v.slack, posted[x] + l, need);
}
}
/// @dev What a refill may post of token `x`: at most `maxPost` of the custody the pool owns of it (the idle floor
/// is checked on the state after the post, {refillBuffer}).
function _budget(FLAMMStore.S storage $, uint256 x, uint256 maxPost) private view returns (uint256) {
uint256 own = FLAMMStore.ownHeld($, x);
return maxPost < own ? maxPost : own;
}
/// @dev Each draw at its venue, after the posts: the Router's borrow into custody, its token's custody raised by it
/// (the borrow is exact; the caller reconciles), each drawn token then within its reserve target
/// (`InvalidConfig` past it), and each draw logged with what its venue took. Returns the drawn tokens, bit `t`
/// for token `t`.
function _borrowAll(
FLAMMStore.S storage $,
VenueRead[] memory rd,
uint256[] memory post,
uint16[] memory ids,
uint256[] memory amounts,
uint256[] memory usd
) private returns (uint256 drawn) {
IMMRouter r = $.router;
for (uint256 i; i < ids.length; ++i) {
uint256 k = _slotOf(rd, ids[i]);
uint256 y = $.pairs[rd[k].pair].debt;
r.borrow(ids[i], amounts[i], address(this), usd);
FLAMMStore.setHeld($, y, FLAMMStore.heldOf($, y) + amounts[i]);
drawn |= uint256(1) << y;
emit BufferRefilled(ids[i], amounts[i], post[k]);
}
for (uint256 m = drawn; m != 0; m &= m - 1) {
uint256 y;
for (uint256 w = m; w & 1 == 0; w >>= 1) ++y;
// the buffer within its guard: no custody of the debt token past its target, which a stranger may repay
if (FLAMMStore.ownHeld($, y) > $.tokens[y].reserveTarget) revert InvalidConfig();
}
}
/// @notice Whether `b` is a custody-blind pool's book (`FLAMMStore.CUSTODY_BLIND`). Only a cheap-lane pool can be
/// one, so a book with no cheap-lane bit (`FLAMMGateLib.laneOn`) reads no storage here.
function blind(FLAMMStore.S storage $, FLAMMGateLib.Book memory b) internal view returns (bool) {
return FLAMMGateLib.laneOn(b) && $.features & FLAMMStore.CUSTODY_BLIND != 0;
}
/// @dev One indebted or drawn venue as the gate reads it ({_walk}): `id`, its slot; `pair` and `coll`, its pair and
/// collateral token by index; `c`, its recognized collateral, and `d`, its debt, in each token's base units
/// (as a refill plans them, then as its lender reports them); `target` and `trig`, its target and trigger
/// LTVs, WAD ({_limits}); `price`, debt base units per collateral base unit, 1e36: its pair's price scale, or
/// the lower of that and its lender's own oracle while the pair's venue-oracle band is on ({_read}); `slack`,
/// what a post there pads, collateral base units ({_slack}).
struct VenueRead {
uint16 id;
uint8 pair;
uint8 coll;
uint256 c;
uint256 d;
uint256 target;
uint256 trig;
uint256 price;
uint256 slack;
}
/// @notice A custody-blind pool's gate after a move that may lower what it posts or raise what it owes outside a
/// pro-rata flow (a refill, a release: {refillBuffer}, `FLAMMMaintainLib.maintain`), at one read of every
/// venue the book reads ({_walk}): every indebted venue within its trigger ({_within}), priced at the
/// pool's price scale or, while its pair's venue-oracle band is on, at the lower of that and its lender's
/// own oracle, as the maintainer prices it ({_read}); and the credit law on the book with no custody and no
/// supply, at the pool's prices ({_shortfall}), each token's debt gross against what the pool posts of it.
/// Returns what it posted; `LedgerBoundBreached` where the law or a venue cannot be brought to hold.
/// @dev - One venue is one health basis (the kinds' admission rule: a lender that pools collateral across pairs
/// holds each venue in an account or sub-account of its own), so no venue counts another's collateral; a
/// frame's account (no collateral token, `FRAME_VENUE` in `IMMRouter.sol`), whose venues share one lender
/// position, is refused both at a venue's admission (`FLAMMAdmitLib._markAdmitted`) and at the birth
/// ({birth}), which reads the venues admitted before the law, as the genesis venues are, out of the
/// admission's reach.
/// - Where `a` is a token the caller may post (`FLAMMLawLib.NONE`: none, a release, which then refuses), each
/// indebted venue past its trigger takes its own lack to its target where it posts `a`, and what the law
/// still lacks at `a` goes to the venues short of their target, most in need first, the rest at venue
/// `home`, the refill's own ({_plan}): no venue is then past its trigger, and none within it lends its lack
/// to another. All within `budget`; a venue past its trigger that posts another token, or a lack at another
/// token, refuses. The venues posted at are read again, and both rules hold on what their lenders credit.
/// What the mode holds, and what it does not:
/// - A cheap fill moves custody alone: no venue's collateral or debt, so nothing this gate reads.
/// - After a refill or a release that passes, every indebted venue sits within its trigger as priced above;
/// one at its pin stays under its lender's threshold through a fall of `1 - pin / threshold` of its
/// collateral's price (41.9 % at 0.5 under 0.86) counted from that venue's last time at its pin, not from
/// the last refill, which may have left it anywhere within its trigger, and the permissionless maintainer
/// takes over past the trigger as far as idle collateral goes.
/// - A wrong pull price on bids (a PRINT listing) loses at most its error times what bids can pay during the
/// episode: the buffer and every refill made in it, as far as the pair's debt cap and the out token's bucket
/// allow, not one buffer. A wrong word on a WORD listing, which no print fences, loses up to the same buffer
/// and refills, as far as the same caps allow, whatever its error. The guardian's pause stops every side,
/// and the keeper or the curator stops refilling on fills that run one way or, on a PRINT listing, on a gap
/// between the pull price and the feed.
function blindGate(FLAMMStore.S storage $, uint256 a, uint256 budget, uint256 home) public returns (uint256 put) {
FLAMMGateLib.Book memory b = _prices($);
(VenueRead[] memory rd, uint256[] memory posted, uint256[] memory owed) = _walk($, b, 0);
uint256[] memory post = new uint256[](rd.length);
put = _plan($, b, rd, post, posted, owed, a, home);
if (put == 0) return 0;
if (put > budget) revert LedgerBoundBreached();
_postAt($, rd, post, a, put);
_reread($, rd, post, posted, owed, 0);
if (_shortfall($, b, posted, owed, FLAMMLawLib.NONE) != 0) revert LedgerBoundBreached();
}
/// @dev The gate's posts on the walk's read, by venue, added to `post`: each indebted venue past its trigger,
/// posting `a`, its own lack to its target (any other refuses); then what the law still lacks at `a` where it
/// lacks: at each indebted venue posting `a` short of its target, most in need first ({_neediest}), as far as
/// its own lack, a lack under `DUST_WAD` of what its venue posts passed over; what is left at venue `home`. So
/// no venue within its trigger but over its target lends its lack to another. Each padded once where its
/// venue's collateral accrues ({_slack}); `posted` and the read take them unpadded. Returns every post's sum,
/// `post`'s planned ones included.
function _plan(
FLAMMStore.S storage $,
FLAMMGateLib.Book memory b,
VenueRead[] memory rd,
uint256[] memory post,
uint256[] memory posted,
uint256[] memory owed,
uint256 a,
uint256 home
) private view returns (uint256 put) {
uint256 n = rd.length;
for (uint256 k; k < n; ++k) {
VenueRead memory v = rd[k];
if (!_within(v)) {
if (v.coll != a) revert LedgerBoundBreached();
uint256 need = FLAMMGateLib.requiredPosted(v.d, v.target, v.price);
(post[k], posted[a], v.c) = (post[k] + need - v.c + v.slack, posted[a] + need - v.c, need);
}
put += post[k];
}
uint256 short = _shortfall($, b, posted, owed, a);
uint256 taken;
while (short != 0) {
(uint256 j, uint256 lack) = _neediest(rd, a, taken);
if (j == n) break;
taken |= uint256(1) << j;
uint256 l = lack < short ? lack : short;
put += _add(rd[j], post, j, l);
(posted[a], short) = (posted[a] + l, short - l);
}
if (short == 0) return put;
uint256 i = _slotOf(rd, home);
if (i == n || rd[i].coll != a) revert LedgerBoundBreached();
put += _add(rd[i], post, i, short);
posted[a] += short;
}
/// @dev Plans a post of `l` at venue `v` (slot `k` of `post`), padded where its collateral accrues ({_slack})
/// unless it takes a post already: what the post adds to the refill's sum.
function _add(VenueRead memory v, uint256[] memory post, uint256 k, uint256 l) private pure returns (uint256 put) {
// a venue whose collateral accrues pads each post once: its pad is in `post` already where it took one
put = post[k] == 0 ? l + v.slack : l;
(post[k], v.c) = (post[k] + put, v.c + l);
}
/// @dev The venue of `rd` posting `a`, outside `taken`, furthest short of what its target needs (the most need per
/// unit posted), and its lack; `rd.length` where none lacks more than `DUST_WAD` of what it posts.
function _neediest(VenueRead[] memory rd, uint256 a, uint256 taken) private pure returns (uint256 j, uint256 lack) {
j = rd.length;
uint256 most;
for (uint256 k; k < rd.length; ++k) {
VenueRead memory v = rd[k];
if (v.coll != a || (taken >> k) & 1 != 0) continue;
uint256 need = FLAMMGateLib.requiredPosted(v.d, v.target, v.price);
if (need <= v.c || (need - v.c) * WAD <= v.c * DUST_WAD) continue;
uint256 r = v.c == 0 ? type(uint256).max : Math.mulDiv(need, WAD, v.c);
if (r > most) (j, lack, most) = (k, need - v.c, r);
}
}
/// @dev The index in `rd` of venue `id`, `rd.length` where it reads none so.
function _slotOf(VenueRead[] memory rd, uint256 id) private pure returns (uint256 k) {
for (; k < rd.length && rd[k].id != id; ++k) {}
}
/// @dev Reverts `VenueReportsLoss` where a venue the refill would post at (`post[k]` nonzero) reports a loss on its
/// collateral of `FLAMMStore.LOSS_MOVE_FLOOR` or more, or takes a redemption fee of any size on it
/// (`FLAMMKeptLib.lossAtFloor`), its marks read first
/// (`FLAMMKeptLib.recordLossMarks`): the caller sizes the post, and NAV, which counts custody at par and cuts
/// what is posted by that ratio, would fall by the ratio's share of it in the call, as at the maintenance
/// path's top-up. A venue that owes there is covered by the collateral maintainer, which the posting law
/// sizes, and by the operator's emergency top-up. A venue it only borrows at, with no new post, is not in the
/// mask, so a refill can still borrow at a fee venue that needs no post; a repay of that venue's whole debt
/// cures it. Read only on a pool that lists a venue whose kind reports a loss (`FLAMMStore.LOSS_MARKS`).
function _requireNoLoss(FLAMMStore.S storage $, VenueRead[] memory rd, uint256[] memory post) private {
if ($.features & FLAMMStore.LOSS_MARKS == 0) return;
FLAMMKeptLib.recordLossMarks();
uint256 at;
for (uint256 k; k < rd.length; ++k) {
if (post[k] != 0) at |= uint256(1) << rd[k].id;
}
// a redemption fee of any size too: the post's way out pays it
if (FLAMMKeptLib.lossAtFloor(at, FLAMMStore.LOSS_LEG_COLLATERAL | FLAMMStore.LOSS_LEG_FEES)) {
revert VenueReportsLoss();
}
}
/// @dev Posts `post[k]` of token `a` at each venue `rd[k]`, `put` in all, out of the custody the pool owns.
function _postAt(FLAMMStore.S storage $, VenueRead[] memory rd, uint256[] memory post, uint256 a, uint256 put)
private
{
address tok = FLAMMStore.tokenOf($, a);
FLAMMStore.setHeld($, a, FLAMMStore.heldOf($, a) - put);
FLAMMStore.grant($, tok, put);
IMMRouter r = $.router;
for (uint256 k; k < rd.length; ++k) {
if (post[k] != 0) r.postCollateral(rd[k].id, post[k]);
}
FLAMMStore.revoke($, tok);
}
/// @dev Reads again each venue `rd[k]` posted at (`post[k]` nonzero) or drawn at (in `draws`): `posted` and `owed`
/// move from its planned read to what its lender now reports, and it must be within its trigger on that
/// (`LedgerBoundBreached`).
function _reread(
FLAMMStore.S storage $,
VenueRead[] memory rd,
uint256[] memory post,
uint256[] memory posted,
uint256[] memory owed,
uint256 draws
) private view {
IMMRouter r = $.router;
for (uint256 k; k < rd.length; ++k) {
VenueRead memory v = rd[k];
if (post[k] == 0 && (draws >> v.id) & 1 == 0) continue;
(uint256 c0, uint256 d0) = (v.c, v.d);
(, v.c,,, v.d) = r.venuePosition(address(this), v.id);
(posted[v.coll], owed[v.pair]) = (posted[v.coll] - c0 + v.c, owed[v.pair] - d0 + v.d);
if (!_within(v)) revert LedgerBoundBreached();
}
}
/// @dev Whether indebted venue `v` is within its trigger: its collateral carries its debt at its trigger LTV.
function _within(VenueRead memory v) private pure returns (bool) {
return v.c >= FLAMMGateLib.requiredPosted(v.d, v.trig, v.price);
}
/// @dev The gate's one read of the venues the book reads (none retired, idle or fenced) and of the venues in
/// `draws`, each from its lender: each one's recognized collateral summed by its collateral token and its debt
/// by its pair, as the Router's book and the per-pair read sum them, and the read ({VenueRead}, {_read}) at
/// `b`'s prices of each one that owes or takes a draw (`InvalidConfig` for a fenced one).
function _walk(FLAMMStore.S storage $, FLAMMGateLib.Book memory b, uint256 draws)
private
view
returns (VenueRead[] memory rd, uint256[] memory posted, uint256[] memory owed)
{
IMMRouter r = $.router;
uint256 n = r.venueCount(address(this));
uint256 skip = (uint256($.retiredVenues) | $.idleVenues) & ~draws;
rd = new VenueRead[](n);
(posted, owed) = (new uint256[](b.legs.length), new uint256[]($.pairCount));
uint256[] memory pv = new uint256[]($.pairCount);
uint256 k;
for (uint256 i; i < n; ++i) {
if ((skip >> i) & 1 != 0) continue;
bool draw = (draws >> i) & 1 != 0;
(, uint256 c,,, uint256 d) = r.venuePosition(address(this), uint16(i));
if ((c | d) == 0 && !draw) continue;
IMMRouter.VenueView memory v = r.venue(address(this), uint16(i));
// a fenced venue: the book reads it not, and it takes no post or draw
if (v.status != 0) {
if (draw) revert InvalidConfig();
continue;
}
(posted[v.coll], owed[v.pair]) = (posted[v.coll] + c, owed[v.pair] + d);
if (d == 0 && !draw) continue;
VenueRead memory x = rd[k++];
(x.id, x.pair, x.coll, x.c, x.d) = (uint16(i), v.pair, v.coll, c, d);
_read(r, v, x, FLAMMGateLib.frameOf(b, v.coll, v.debt), pv, $.pairs[v.pair].ltvWad, b.legs[v.coll].scale);
}
assembly ("memory-safe") {
mstore(rd, k)
}
}
/// @dev The credit law on the book with no custody and no supply, from the walk's sums: each live pair's debt
/// (`owed`, by pair) charged at its collateral token's price scale and its LTV, against what the pool posts of
/// that token (`posted`, by token), so a token owed at two or more pairs carries each pair's whole debt
/// (`FLAMMLawLib`'s forced load, as nothing held nets it). Returns what the law lacks at token `a`, the one
/// token the caller may post; `LedgerBoundBreached` where it lacks at another (`FLAMMLawLib.NONE`: any) or a
/// pair that is not live owes; `CircularBook` where an indebted pair's collateral is owed; `PriceUnchecked`
/// where a charged pair's price scale is unchecked.
function _shortfall(
FLAMMStore.S storage $,
FLAMMGateLib.Book memory b,
uint256[] memory posted,
uint256[] memory owed,
uint256 a
) private view returns (uint256 short) {
uint256 m = owed.length;
uint256[] memory load = new uint256[](posted.length);
uint256 owing;
for (uint256 q; q < m; ++q) {
if (owed[q] != 0) owing |= uint256(1) << $.pairs[q].debt;
}
for (uint256 q; q < m; ++q) {
uint256 d = owed[q];
if (d == 0) continue;
FLAMMStore.PairCfg storage pc = $.pairs[q];
(uint256 x, uint256 t) = (pc.coll, pc.debt);
if (!pc.live) revert LedgerBoundBreached();
if ((owing >> x) & 1 != 0) revert CircularBook();
uint256 p = FLAMMGateLib.frameOf(b, x, t);
if (p == 0) revert PriceUnchecked();
load[x] += FLAMMLawLib.term(d, p, pc.ltvWad);
}
for (uint256 t; t < posted.length; ++t) {
uint256 g = posted[t] * WAD;
if (load[t] <= g) continue;
if (t != a) revert LedgerBoundBreached();
short = (load[t] - g + WAD - 1) / WAD;
}
}
/// @dev Venue `v`'s read past its figures (`x`): its price, the pool's price scale `p` (zero: `PriceUnchecked`) or,
/// while its pair's venue-oracle band is on, the lower of that and its lender's own oracle, as the maintainer
/// prices a due venue (`FLAMMTopUpLib`), so the gate and the maintainer read one venue alike; its target and
/// trigger ({_limits}); its pad ({_slack}). `pv` holds each pair's band and gap, read once.
function _read(
IMMRouter r,
IMMRouter.VenueView memory v,
VenueRead memory x,
uint256 p,
uint256[] memory pv,
uint256 pin,
uint256 scale
) private view {
if (p == 0) revert PriceUnchecked();
uint256 w = pv[v.pair];
if (w == 0) {
IMMRouter.PairView memory pr = r.pair(address(this), v.pair);
w = (uint256(1) << 255) | (uint256(pr.oracleBandWad) << 64) | pr.safetyGapWad;
pv[v.pair] = w;
}
if (uint64(w >> 64) != 0 && v.lltvWad != 0) {
(bool ok, uint256 q) = IFinancingAccount(v.account).oraclePrice(v.id);
if (ok && q != 0 && q < p) p = q;
}
uint256 caps = IFinancingAccount(v.account).capabilities();
(x.target, x.trig) = _limits(v.lltvWad, pin, uint64(w), caps);
(x.price, x.slack) = (p, _slack(v, caps, scale));
}
/// @dev A venue's target and trigger LTVs at threshold `lltv`, the maintainer's (`FLAMMTopUpLib`): the target is
/// its pair's pin `pin`, or, at a kind whose threshold can fall (`CAP_MUTABLE_THRESHOLD`) and was cut under
/// the pin plus the pair's gap `gap` but not to it, the threshold less the gap; a cut to the gap or under it
/// keeps the pin, as before the cut, where the venue is then within its trigger at or under its pin (and no
/// draw runs there: the Router's pin check refuses it). The trigger is `MAINTAIN_ROOM_SHARE_WAD` of the room
/// from the target to the threshold past it, the target where the threshold is under it. The maintainer keeps
/// the pin too where custody cannot bring the venue under its threshold at the lower price; the gate, which
/// reads no custody, holds such a venue to the cut target, the stricter.
function _limits(uint256 lltv, uint256 pin, uint256 gap, uint256 caps)
private
pure
returns (uint256 target, uint256 trig)
{
target = pin;
if (caps & CAP_MUTABLE_THRESHOLD != 0 && lltv < pin + gap && lltv > gap) target = lltv - gap;
trig = lltv > target ? target + (lltv - target) * FLAMMTopUpLib.MAINTAIN_ROOM_SHARE_WAD / WAD : target;
}
/// @dev What a post at venue `v` pads past its need where its collateral accrues (`CAP_ACCRUING_COLLATERAL`): one
/// unit's assets, at most a millionth of one whole collateral token (its scale `scale`), and one, which the
/// lender's rounding may keep of the post, as the Router pads its plan's posts (`MMRouterLib._postSlack`).
function _slack(IMMRouter.VenueView memory v, uint256 caps, uint256 scale) private view returns (uint256 s) {
if (caps & CAP_ACCRUING_COLLATERAL == 0) return 0;
s = IFinancingAccount(v.account).collateralUnitsToAssets(v.id, 1);
uint256 most = 1e12 / scale;
return (s < most ? s : most) + 1;
}
/// @notice What a flush on a custody-blind pool repays of token `a` at pair `p` (`FLAMMStore.NO_PAIR`: every pair
/// owing it) out of `own`, the custody the pool owns of it, toward `owed` (`FLAMMFloatLib.flush`,
/// `flushPair`, which repay what this returns and count every repay by the token's balance): for the keeper
/// or the curator all it owes, as far as custody goes; for anyone else the custody past the token's reserve
/// target, the buffer a refill borrowed ({refillBuffer}), so no stranger unwinds it and the
/// refill's gas and interest are not anyone's to waste. Where the target holds some custody back and an
/// indebted venue of those pairs is past its trigger, as the gate prices it ({_read}), anyone first repays
/// here at each such venue, most past first, as far as its debt over what its collateral carries at its
/// target ({_repayPast}), so exits reopen and the lender does not liquidate it while the buffer sits in
/// custody, and then the custody still past the target. A repay never raises a venue's ratio, so it needs
/// no gate after it.
function repayable(FLAMMStore.S storage $, uint256 a, uint256 own, uint256 owed, uint8 p)
public
returns (uint256 pay)
{
pay = owed < own ? owed : own;
if (msg.sender == $.core.keeper() || msg.sender == $.core.owner()) return pay;
uint256 t = $.tokens[a].reserveTarget;
if (own > t && own - t >= pay) return pay;
(uint256 owing,) = FLAMMStore.lanes($, a);
uint256 cured = _repayPast($, a, p == FLAMMStore.NO_PAIR ? owing : owing & (uint256(1) << p), pay);
(own, owed) = (own - cured, owed - cured);
uint256 rest = own > t ? own - t : 0;
pay = rest < owed ? rest : owed;
}
/// @dev Repays token `a` at each indebted venue of a pair in `pairs` (bit `p` for pair `p`) past its trigger, as
/// the gate prices it ({_read}; a pair whose price cannot be read counts no venue), the furthest past first
/// ({_mostPast}), each as far as its debt over what its collateral carries at its target, out of at most
/// `budget` of the token's custody; a venue that refuses a repay now is passed over. Returns what it repaid.
function _repayPast(FLAMMStore.S storage $, uint256 a, uint256 pairs, uint256 budget)
private
returns (uint256 cured)
{
IMMRouter r = $.router;
VenueRead[] memory rd = _pastVenues($, r, pairs);
if (rd.length == 0) return 0;
address tok = FLAMMStore.tokenOf($, a);
FLAMMStore.approveRouter($, tok, budget);
uint256 done;
while (budget != 0) {
(uint256 j, uint256 lack) = _mostPast(rd, done);
if (j == rd.length) break;
done |= uint256(1) << j;
if (FLAMMGateLib.repayRefused($, rd[j].id)) continue;
uint256 got = r.repay(rd[j].id, lack < budget ? lack : budget);
(cured, budget) = (cured + got, budget - got);
}
FLAMMStore.revoke($, tok);
}
/// @dev The indebted venues of the pairs in `pairs`, none retired, idle or fenced, past their trigger.
function _pastVenues(FLAMMStore.S storage $, IMMRouter r, uint256 pairs)
private
view
returns (VenueRead[] memory rd)
{
rd = new VenueRead[](r.venueCount(address(this)));
uint256[] memory pv = new uint256[]($.pairCount);
uint256 skip = $.retiredVenues | $.idleVenues;
uint256 k;
for (uint256 q; pairs >> q != 0; ++q) {
if ((pairs >> q) & 1 == 0) continue;
FLAMMStore.PairCfg storage pc = $.pairs[q];
(uint8 x, uint8 y) = (pc.coll, pc.debt);
(bool ok, uint256 ux, uint256 uy,) =
$.priceFeed.peekPair(FLAMMStore.tokenOf($, x), FLAMMStore.tokenOf($, y));
uint256 p = ok ? FLAMMGateLib.frame(ux, uy, _scaleOf($, x), _scaleOf($, y)) : 0;
if (p == 0) continue;
for (uint256 m = pc.venues & ~skip; m != 0; m &= m - 1) {
uint256 i;
for (uint256 w = m; w & 1 == 0; w >>= 1) ++i;
(, uint256 c,,, uint256 d) = r.venuePosition(address(this), uint16(i));
if (d == 0) continue;
IMMRouter.VenueView memory v = r.venue(address(this), uint16(i));
if (v.status != 0) continue;
VenueRead memory e = rd[k];
(e.id, e.pair, e.coll, e.c, e.d) = (uint16(i), v.pair, v.coll, c, d);
_read(r, v, e, p, pv, pc.ltvWad, _scaleOf($, x));
if (!_within(e)) ++k;
}
}
assembly ("memory-safe") {
mstore(rd, k)
}
}
/// @dev The venue of `rd` outside `done` furthest past its trigger (the most it needs at its trigger per unit it
/// posts), and its debt over what its collateral carries at its target, rounded up; `rd.length` where none.
function _mostPast(VenueRead[] memory rd, uint256 done) private pure returns (uint256 j, uint256 lack) {
j = rd.length;
uint256 most;
for (uint256 k; k < rd.length; ++k) {
if ((done >> k) & 1 != 0) continue;
VenueRead memory v = rd[k];
uint256 need = FLAMMGateLib.requiredPosted(v.d, v.trig, v.price);
uint256 r = v.c == 0 ? type(uint256).max : Math.mulDiv(need, WAD, v.c);
if (r <= most) continue;
uint256 carried = Math.mulDiv(Math.mulDiv(v.c, v.price, 1e36), v.target, WAD);
(j, lack, most) = (k, v.d > carried ? v.d - carried : 0, r);
}
}
/// @notice `FLAMMFloatLib.setIdleFloor`'s body, out of that library so it keeps its room: on a custody-blind pool
/// (`InvalidConfig` on any other), the curator's or the guardian's raise of the idle floor applies at once
/// and drops a scheduled cut; a cut is the curator's alone, through the pending table (`FLAMMLane.capDue`):
/// the first call schedules it for the pool's delay, the identical call within one more delay applies it.
function setIdleFloor(FLAMMStore.S storage $, uint128 floor) public {
bool tight = floor >= $.idleFloor;
bool guardian = FLAMMStore.curatorOrGuardian($);
if (guardian && !tight) revert GuardianMayOnlyTighten();
ReentrancyGuardLib._guard();
if ($.features & FLAMMStore.CUSTODY_BLIND == 0) revert InvalidConfig();
if (FLAMMLane.capDue($, tight, abi.encode(SET_IDLE_FLOOR, floor)) == 0) {
$.idleFloor = floor;
emit IdleFloorSet(floor);
}
ReentrancyGuardLib._unlockGuard();
}
/// @dev The book's prices alone, for the gate, which reads no custody: every token's USD price and price scale
/// (`FLAMMGateLib.priceIn`) on legs that carry only their scale.
function _prices(FLAMMStore.S storage $) private view returns (FLAMMGateLib.Book memory b) {
uint256 n = $.tokenCount;
(b.legs, b.usd) = (new FLAMMGateLib.Leg[](n), new uint256[](n));
b.legs[0].scale = $.shareScale;
for (uint256 t = 1; t < n; ++t) {
b.legs[t].scale = $.tokens[t].scale;
}
FLAMMGateLib.priceIn($, b);
}
/// @dev Token `t`'s scale: the pool asset's from the first word.
function _scaleOf(FLAMMStore.S storage $, uint256 t) private view returns (uint256) {
return t == 0 ? $.shareScale : $.tokens[t].scale;
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {
"src/core/mm/MMRouterLib.sol": {
"MMRouterLib": "0xA4749766934833DfBeaF4Fc0d79c150A1Dd2B4E5"
},
"src/core/flamm/FLAMMLane.sol": {
"FLAMMLane": "0x0988077AB06F1efd8cFa3f08FC60CAf3e6d22e98"
},
"src/core/flamm/FLAMMRoute.sol": {
"FLAMMRoute": "0x312ee92ecd113F925dD513d450b062C8740fDaA9"
},
"src/periphery/FLAMMMaxima.sol": {
"FLAMMMaxima": "0x4A997343D91c981BF63274fc222AA96D32d6259c"
},
"src/core/flamm/FLAMMLawLib.sol": {
"FLAMMLawLib": "0x5D473B15E032756Cd81fc66B8F1e9BE2f427cc62"
},
"src/core/flamm/FLAMMOpsLib.sol": {
"FLAMMOpsLib": "0x0BFe60fB1f5223F1A2b7B02Ef18f5C33fb043753"
},
"src/core/mm/AaveV3ReadsLib.sol": {
"AaveV3ReadsLib": "0xD53F6170226A74D453e84414Ffc2FFcE5ded5983"
},
"src/core/flamm/FLAMMFlowLib.sol": {
"FLAMMFlowLib": "0x2577D707D41209489b2EF53101a4f6baDd4E3473"
},
"src/core/flamm/FLAMMGateLib.sol": {
"FLAMMGateLib": "0xF0BE115A2D6F27274F2e9EE50B89Ed42db2B9555"
},
"src/core/flamm/FLAMMKeptLib.sol": {
"FLAMMKeptLib": "0x7a11899232dd9F17c28bF062Ec2ee2267158517b"
},
"src/core/mm/CTokenMarketLib.sol": {
"CTokenMarketLib": "0x18c53F2aCAbcDEEdb575A136f49fa4C43EB2071c"
},
"src/core/flamm/FLAMMAdmitLib.sol": {
"FLAMMAdmitLib": "0xA6dBD8cD5Cd10F8a5857cbeD54a28405ffbDcBCb"
},
"src/core/flamm/FLAMMBlindLib.sol": {
"FLAMMBlindLib": "0x0b8d436F1a7AE25C5d16955ed4CDa781E42e7E5C"
},
"src/core/flamm/FLAMMClaimLib.sol": {
"FLAMMClaimLib": "0x02b4354a56630ab165A880B1198a603E62731cCE"
},
"src/core/flamm/FLAMMFenceLib.sol": {
"FLAMMFenceLib": "0xA16ddA83f47a42F875f141b6954595D584a201e8"
},
"src/core/flamm/FLAMMFloatLib.sol": {
"FLAMMFloatLib": "0x539EfC2b17cF0fdF254AAaB925b3A7c360A79737"
},
"src/core/flamm/FLAMMQuoteLib.sol": {
"FLAMMQuoteLib": "0xa4D34f4882a529574840881e755BCFae2bd5ce2e"
},
"src/core/flamm/FLAMMTopUpLib.sol": {
"FLAMMTopUpLib": "0x7C55a535Ce298b1e5e6d00F645088F777ad233DF"
},
"src/core/mm/CTokenRewardsLib.sol": {
"CTokenRewardsLib": "0xcda63d7eCCF838F2732Bff676706BDE5abA4DcF7"
},
"src/core/mm/MMRouterAdminLib.sol": {
"MMRouterAdminLib": "0x8423744b3F304ED0B43043d7ad4E7d8A247aDc96"
},
"src/core/flamm/FLAMMPolicyLib.sol": {
"FLAMMPolicyLib": "0xa6B495B2BdcDcf4F327844d9aaA0eD4C550c67F9"
},
"src/core/flamm/FLAMMSettleLib.sol": {
"FLAMMSettleLib": "0xB4890a27205505BDAA05717B6c3aB38b2dd3C7Cb"
},
"src/core/flamm/FLAMMSharedLib.sol": {
"FLAMMSharedLib": "0xFaAEd38962aEb6c282Ac36E0cdE9313AbA2511ba"
},
"src/periphery/FLAMMExitMaxima.sol": {
"FLAMMExitMaxima": "0x480f51866554e92649c9d3502bA31AA4234e0a81"
},
"src/hooks/everlong/LeverageLib.sol": {
"LeverageLib": "0x1B1D1C42d26c169dB59D8681d0FD4C9a2840Ad11"
},
"src/core/flamm/FLAMMMaintainLib.sol": {
"FLAMMMaintainLib": "0x94998f13fc5d5D2271c90b835c6a805dad409cC2"
},
"src/core/flamm/FLAMMPairQuoteLib.sol": {
"FLAMMPairQuoteLib": "0x077523D1427aE408105fe8592F907ECDa0D94cbE"
},
"src/hooks/everlong/EverlongOpsLib.sol": {
"EverlongOpsLib": "0xAbe4447C954E3C7a405f8E75116BF9f5787426F7"
}
},
"optimizer": {
"runs": 100,
"enabled": true
},
"viaSSACFG": false,
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts-compat/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable-compat/contracts/",
"solady/=lib/solady/src/",
"forge-std/=lib/forge-std/src/"
],
"experimental": false
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.