Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ComponentRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ error ComponentRegistry_UsdcFeedNotSet();
* non-positive answer reverts so that price-sensitive vault operations
* (mint, settle, rebalance) fail closed instead of transacting on bad data.
* @dev Prices are normalized to 8 decimals regardless of feed decimals.
* Supply-oracle bindings and reconstitution metadata land here in Phase 3.
* Supply-oracle bindings and reconstitution metadata land here later.
*/
contract ComponentRegistry is Ownable2Step {
struct Component {
Expand Down Expand Up @@ -111,7 +111,7 @@ contract ComponentRegistry is Ownable2Step {
/// @notice Removes a constituent from the registry.
/// @dev The vault may still hold a balance of a removed token; removal only
/// stops it being valued and traded. Deregistration policy (forced exit of
/// the position first) is enforced at the rebalancer layer in Phase 4.
/// the position first) is enforced at the rebalancer layer.
function removeComponent(address token) external onlyOwner {
if (_components[token].token == address(0)) revert ComponentRegistry_NotRegistered(token);

Expand Down
9 changes: 3 additions & 6 deletions src/IndexVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ error IndexVault_SettleIntervalNotPassed();
error IndexVault_RequestBlockDelayNotPassed();

/// @notice Thrown when the idle buffer cannot cover the epoch's pending redemptions.
/// @dev Until the Phase 4 rebalancer can free USDC from the basket, settlement
/// @dev Until the rebalancer can free USDC from the basket, settlement
/// requires the buffer to cover net outflows.
error IndexVault_InsufficientSettlementLiquidity(uint256 required, uint256 available);

Expand Down Expand Up @@ -72,10 +72,7 @@ error IndexVault_InvalidSettleParams();
* operations revert rather than transact on bad data.
*
* Pending redemptions are priced at settle time, not request time, which is
* fairer to remaining holders (spec Section 12, decision 1).
*
* Phase 1 scope: no methodology engine, no rebalancer, no fees. Target
* weights and basket deployment arrive in Phases 2 and 4.
* fairer to remaining holders.
*/
contract IndexVault is ERC4626, Ownable2Step, IERC7540 {
using SafeERC20 for IERC20;
Expand Down Expand Up @@ -536,7 +533,7 @@ contract IndexVault is ERC4626, Ownable2Step, IERC7540 {
}

/// @notice Sets the buffer band. Low and high gate the sync lanes; target
/// is the level the Phase 4 rebalancer tops the buffer back toward.
/// is the level the rebalancer tops the buffer back toward.
function setBufferBand(uint16 lowBps, uint16 targetBps, uint16 highBps) external onlyOwner {
if (lowBps == 0 || lowBps > targetBps || targetBps > highBps || highBps >= BPS) {
revert IndexVault_InvalidBufferBand();
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISupplyOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity 0.8.28;
* @title ISupplyOracle
* @notice Source of float-adjusted circulating supply per constituent. The
* methodology engine consumes an already-float-adjusted figure and does not
* itself decide float (spec Section 5.2). The implementation layers on-chain
* itself decide float. The implementation layers on-chain
* derivation, a multi-source median with divergence freeze, and containment
* guards behind this interface, so the methodology never needs to know how
* the number was secured.
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/WeightMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
* @title WeightMath
* @notice Pure index-weighting math: iterative cap-and-redistribute, exact
* renormalization, and the minimum-weight floor. This is the textbook capped
* market-cap methodology (spec Section 5.3): a hard per-asset cap with the
* market-cap methodology: a hard per-asset cap with the
* overflow redistributed pro-rata to uncapped constituents, iterated because
* redistribution can push a previously-uncapped name over the cap.
*
Expand Down Expand Up @@ -177,7 +177,7 @@ library WeightMath {
}

// ========================================================================
// Reconstitution buffer rule (spec Section 5.4)
// Reconstitution buffer rule
// ========================================================================

/**
Expand Down
14 changes: 7 additions & 7 deletions src/methodology/MarketCapMethodology.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ error MarketCapMethodology_InvalidParams();
/**
* @title MarketCapMethodology
* @notice Reference IMethodology implementation: float-adjusted market-cap
* weighting with a hard per-asset cap, iteratively redistributed (spec
* Section 5.3), and a minimum-weight floor that prunes dust positions. This
* is standard index-provider methodology (capped market-cap with float
* adjustment), which almost no on-chain index implements correctly.
* weighting with a hard per-asset cap, iteratively redistributed, and a
* minimum-weight floor that prunes dust positions. This is standard
* index-provider methodology (capped market-cap with float adjustment),
* which almost no on-chain index implements correctly.
*
* The cap does security work beyond diversification: large constituents are
* pinned at the cap regardless of their exact supply, so supply-oracle
* precision only matters for the mid and long tail, where the value at risk
* from manipulation is smaller (spec Section 8.4).
* from manipulation is smaller.
*/
contract MarketCapMethodology is IMethodology, Ownable2Step {
using Math for uint256;
Expand All @@ -55,7 +55,7 @@ contract MarketCapMethodology is IMethodology, Ownable2Step {
/// supply arrived in native token decimals instead of whole tokens.
uint256 public constant MARKET_CAP_SANITY_BOUND = 1e30;

/// @notice Hard per-asset weight cap in WAD. Default 25% (spec Section 12).
/// @notice Hard per-asset weight cap in WAD. Default 25%.
uint256 public capWad = 0.25e18;

/// @notice Minimum weight in WAD below which a constituent is pruned to
Expand Down Expand Up @@ -102,7 +102,7 @@ contract MarketCapMethodology is IMethodology, Ownable2Step {
}

/// @notice Sets the per-asset cap and the minimum-weight floor.
/// @dev Methodology-admin lever; sits behind the Phase 5 timelock.
/// @dev Methodology-admin lever; sits behind the methodology-admin timelock.
/// The cap must be feasible for the constituent set: getWeights reverts
/// with WeightMath_CapInfeasible when the number of nonzero-market-cap
/// constituents k satisfies k * capWad < 1e18 (a 25% cap needs at least
Expand Down
4 changes: 2 additions & 2 deletions src/oracle/ExcludedAddressRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ error ExcludedRegistry_InvalidDelay(uint256 delay);

/**
* @title ExcludedAddressRegistry
* @notice Layer 1 of the supply oracle (spec Section 8.1): minimize the
* @notice Layer 1 of the supply oracle: minimize the
* off-chain surface by deriving circulating supply on-chain wherever possible.
*
* Circulating supply is computed directly as
Expand Down Expand Up @@ -107,7 +107,7 @@ contract ExcludedAddressRegistry is Ownable2Step {
}

/// @notice Cancels a pending change before it executes. The owner today,
/// the guardian once Phase 5 wires fast pause powers in.
/// the guardian once fast pause powers are wired in.
function cancelChange(address token, address account, bool exclude) external onlyOwner {
bytes32 id = changeId(token, account, exclude);
if (!pendingChanges[id].exists) revert ExcludedRegistry_NoPendingChange(id);
Expand Down
6 changes: 3 additions & 3 deletions src/oracle/SupplyOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ error SupplyOracle_InvalidParams();

/**
* @title SupplyOracle
* @notice Layers 2 and 3 of the supply-oracle design (spec Section 8), built
* @notice Layers 2 and 3 of the supply-oracle design, built
* on the Layer 1 on-chain derivation in ExcludedAddressRegistry.
*
* Free-float supply is expressed as
Expand All @@ -69,7 +69,7 @@ error SupplyOracle_InvalidParams();
* disagree, the commit reverts and the constituent freezes at its last-good
* factor rather than acting on disputed data. This interface is shaped so an
* optimistic oracle can later replace the reporter-median residual per
* constituent without the methodology engine noticing (spec Section 8.2).
* constituent without the methodology engine noticing.
*
* Layer 3, contain. The committed factor moves toward the median by at most
* `maxFactorDeltaBps` per commit, and a `minCommitInterval` cooldown spreads
Expand Down Expand Up @@ -102,7 +102,7 @@ contract SupplyOracle is ISupplyOracle, Ownable2Step {
/// @notice Layer 1 on-chain circulating-supply source.
ExcludedAddressRegistry public immutable EXCLUDED;

/// @notice Guardian with pause-only powers (spec Section 10).
/// @notice Guardian with pause-only powers.
address public guardian;

/// @notice When true, every read fails closed.
Expand Down
2 changes: 1 addition & 1 deletion test/IndexVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract IndexVaultTest is Test {
}

/// @dev Simulates a deployed basket: 1 WBTC ($100k) + 20 WETH ($100k)
/// held by the vault, as the Phase 4 rebalancer would leave it.
/// held by the vault, as the rebalancer would leave it.
function _seedBasket() internal {
wbtc.mint(address(vault), 1e8);
weth.mint(address(vault), 20e18);
Expand Down
2 changes: 1 addition & 1 deletion test/MarketCapMethodology.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ contract MarketCapMethodologyTest is Test {
}

function test_GetWeights_CapDoesSecurityWork() public {
// Spec Section 8.4: a manipulated supply on a capped constituent must
// A manipulated supply on a capped constituent must
// not move its weight. Double BTC's reported supply; BTC stays at cap.
uint256[] memory before = methodology.getWeights(tokens);
supplyOracle.setSupply(address(wbtc), 40_000_000);
Expand Down
2 changes: 1 addition & 1 deletion test/SupplyOracleIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ contract SupplyOracleIntegrationTest is Test {
assertEq(sum, WAD);
}

/// @notice Section 8.4: a capped constituent's weight is independent of its
/// @notice A capped constituent's weight is independent of its
/// supply-oracle value. Move BTC's free-float factor through the full
/// committed range and its weight never leaves the cap.
function test_CapNeutralizesSupplyOracleOnLargeConstituent() public {
Expand Down
2 changes: 1 addition & 1 deletion test/WeightMath.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract WeightMathTest is Test {
}

// ========================================================================
// applyCap, property fuzz (spec Section 13 phase 2)
// applyCap, property fuzz
// ========================================================================

/// @notice For any normalized weight vector and feasible cap: the output
Expand Down