Enhanced version of BC_Discrete_Redeeming_VirtualSupply that enforces specific referenceCurve segment rules and provides collateral-based referenceCurve management. Source: src/core/issuance/ReferenceCurve_v1.sol. Interfaces: IReferenceCurve_v1, IBC_Discrete_Redeeming_VirtualSupply_v1, IRedeemingIssuanceBase_v2, IIssuanceBase_v2, IVirtualCollateralSupplyBase_v1.

Functions

buy

Buy tokens for the sender’s address. Parameters Returns IIssuanceBase_v2.sol#L141

buyFor

Buy tokens on behalf of a specified receiver address. Parameters Returns IIssuanceBase_v2.sol#L130

calculatePurchaseReturn

Calculates the amount of tokens to be minted based on a given deposit amount. Parameters Returns IIssuanceBase_v2.sol#L112

disableBuy

Closes the buying functionality for the token. IIssuanceBase_v2.sol#L154

disableSell

Closes the selling functionality for the collateral. IRedeemingIssuanceBase_v2.sol#L136

drawReserves

Transfers collateral tokens to to_ without modifying virtual collateral supply. Only the bound ReserveManager may call. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L172

elevate

Increases the referenceCurve by injecting collateral and dynamically absorbing premium steps. Parameters IReferenceCurve_v1.sol#L324

enableBuy

Opens the buying functionality for the token. IIssuanceBase_v2.sol#L150

enableBuy

Opens buying if no disable happened since the call was prepared. Parameters IReferenceCurve_v1.sol#L264

enableSell

Opens the selling functionality for the collateral. IRedeemingIssuanceBase_v2.sol#L131

enableSell

Opens selling if no disable happened since the call was prepared. Parameters IReferenceCurve_v1.sol#L270

reconfigureSegments

Reconfigures the segments of the discrete bonding curve. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L140

restoreReserves

Pulls collateral tokens from from_ without modifying virtual collateral supply. Only the bound ReserveManager may call. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L188

sell

Redeem collateral for the sender’s address. Parameters Returns IRedeemingIssuanceBase_v2.sol#L121

sellTo

Redeem tokens and direct the proceeds to a specified receiver address. Parameters Returns IRedeemingIssuanceBase_v2.sol#L110

setBuyFee

Sets the fee percentage for buying tokens, payed in collateral. Parameters IIssuanceBase_v2.sol#L158

setEndowmentSetupOpen

Parameters IReferenceCurve_v1.sol#L246

setReferenceSellController

Parameters IReferenceCurve_v1.sol#L247

setReferenceSellsClosed

Parameters IReferenceCurve_v1.sol#L248

setSellFee

Sets the fee percentage for selling collateral, payed in collateral. Parameters IRedeemingIssuanceBase_v2.sol#L144

setVirtualCollateralSupply

Disabled in this implementation. Manual virtual collateral supply overrides are prohibited in all states, including while trading is closed and before any issuance. The external selector is retained for ABI stability, but every authorized call reverts with Module__BC_Discrete_Redeeming_VirtualSupply__ManualVirtualSupplyOverrideDisabled. Initialization and internal automatic accounting remain intact: buys, sells, elevation, and collateral supplied through segment reconfiguration update virtual collateral supply. ReserveManager drawReserves and restoreReserves intentionally leave it unchanged; reserve liabilities are tracked separately. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L161

View functions

areReferenceSellsClosed

Returns IReferenceCurve_v1.sol#L245

calculateSaleReturn

Calculates the amount of tokens to be redeemed based on a given deposit amount. Parameters Returns IRedeemingIssuanceBase_v2.sol#L89

getBuyFee

Returns the current buy fee in basis points. Returns IIssuanceBase_v2.sol#L86

getCollateralToken

Returns the address of the collateral token. Returns IIssuanceBase_v2.sol#L94

getDisableEpochs

Returns the disable epochs. Each {disableBuy} increments the buy epoch and each {disableSell} the sell epoch. {enableBuy} and {enableSell} must pass the current value. Returns IReferenceCurve_v1.sol#L255

getIssuanceToken

Returns the address of the issuance token. Returns IIssuanceBase_v2.sol#L90

getPremiumSections

Returns all premium sections (segments after the referenceCurve). Returns IReferenceCurve_v1.sol#L281

getReferenceMetrics

Returns comprehensive referenceCurve metrics. Returns IReferenceCurve_v1.sol#L299

getReferencePrice

Returns the reference price of the bonding curve. Returns IReferenceCurve_v1.sol#L292

getReferenceSection

Returns the referenceCurve section (first segment) of the bonding curve. Returns IReferenceCurve_v1.sol#L274

getReferenceSellController

Returns IReferenceCurve_v1.sol#L241

getSegments

Returns the current configuration of the bonding curve segments. Returns IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L102

getSellFee

Returns the current sell fee in basis points. Returns IRedeemingIssuanceBase_v2.sol#L71

getStaticPriceForBuying

Returns the static price for buying one unit of the issuance token. Returns IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L111

getStaticPriceForSelling

Returns the static price for selling one unit of the issuance token. Returns IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L117

getVirtualCollateralSupply

Returns the current virtual collateral supply. Returns IVirtualCollateralSupplyBase_v1.sol#L64

isBuyOpen

Returns whether the buying functionality is open or closed. Returns IIssuanceBase_v2.sol#L82

isEndowmentSetupOpen

Returns IReferenceCurve_v1.sol#L240

isSellOpen

Returns whether the selling functionality is open or closed. Returns IRedeemingIssuanceBase_v2.sol#L67

maxElevatable

The largest collateral budget {elevate} accepts right now without reverting — a bounded chunk (raises the reference price up to, but not into, the final premium step, and across at most a fixed number of steps per call); 0 when no productive elevation is possible. Use the explicit-cap overload for a limited balance: smaller budgets are not necessarily funded. Returns IReferenceCurve_v1.sol#L333

maxElevatable

Selects the greatest funded, productive executable budget at or below cap_, within the same bounded chunk as maxElevatable(). Parameters Returns IReferenceCurve_v1.sol#L339

Events

BuyFeeUpdated

Event emitted when buy fee is updated. Parameters IIssuanceBase_v2.sol#L52

BuyingDisabled

Event emitted when buying is closed. IIssuanceBase_v2.sol#L47

BuyingEnabled

Event emitted when buying is opened. IIssuanceBase_v2.sol#L44

CollateralDeposited

Emitted when collateral is deposited (repaid) to reserves. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L92

CollateralTokenSet

Event emitted when the collateral token is updated. Parameters IIssuanceBase_v2.sol#L61

CollateralWithdrawn

Emitted when collateral is withdrawn (lent out) from reserves. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L84

Elevated

Emitted when the reference price is increased. Parameters IReferenceCurve_v1.sol#L205

ElevationSurplusAbsorbed

Emitted by {elevate} when virtual collateral above the reserve of the current segments (surplus) pays for part of the floor rise. Elevated.collateralConsumed_ stays the amount pulled from the caller. Parameters IReferenceCurve_v1.sol#L217

EndowmentSetupStateChanged

Parameters IReferenceCurve_v1.sol#L44

IssuanceTokenSet

Event emitted when the issuance token is updated. Parameters IIssuanceBase_v2.sol#L57

ReferenceAdjustedToSupply

Emitted when the referenceCurve is adjusted to fit the supply. Parameters IReferenceCurve_v1.sol#L198

ReferencePriceUpdated

Emitted when the reference price is updated. Parameters IReferenceCurve_v1.sol#L221

ReferenceSellControllerSet

Parameters IReferenceCurve_v1.sol#L45

ReferenceSellsClosed

Parameters IReferenceCurve_v1.sol#L46

SegmentsSet

Emitted when the bonding curve segments are set or updated. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L78

SellFeeUpdated

Event emitted when sell fee is updated. Parameters IRedeemingIssuanceBase_v2.sol#L46

SellingDisabled

Event emitted when selling is closed. IRedeemingIssuanceBase_v2.sol#L41

SellingEnabled

Event emitted when selling is opened. IRedeemingIssuanceBase_v2.sol#L38

SpotToleranceBpsUpdated

Emitted when the spot tolerance used by rebalances changes. Parameters IReferenceCurve_v1.sol#L233

TerminalLeftoverSentToFeeTreasury

Emitted when a terminal sell (supply 0, every ReserveManager liability 0) clears the virtual collateral supply and sends the collateral left on the curve to the fee treasury. Parameters IReferenceCurve_v1.sol#L228

TokensBought

Event emitted when tokens have been succesfully issued. Parameters IIssuanceBase_v2.sol#L69

TokensSold

Event emitted when tokens have been succesfully redeemed. Parameters IRedeemingIssuanceBase_v2.sol#L54

VirtualCollateralAmountAdded

Event emitted when virtual collateral amount has been added. Parameters IVirtualCollateralSupplyBase_v1.sol#L38

VirtualCollateralAmountSubtracted

Event emitted when virtual collateral amount has been subtracted. Parameters IVirtualCollateralSupplyBase_v1.sol#L45

VirtualCollateralSupplySet

Event emitted when virtual collateral supply has been set. Parameters IVirtualCollateralSupplyBase_v1.sol#L33

Errors

Module__BC_Discrete_Redeeming_VirtualSupply__CurveInteractionsOpen

Legacy error retained for ABI compatibility. IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L59

Module__BC_Discrete_Redeeming_VirtualSupply__InsufficientCollateralBalance

Thrown when selfSupplied reconfiguration claims more collateral than the contract actually holds in excess of the current virtual supply. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L48

Module__BC_Discrete_Redeeming_VirtualSupply__InvarianceCheckFailed

Thrown when a curve reconfiguration fails the invariance check. Parameters IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L38

Module__BC_Discrete_Redeeming_VirtualSupply__ManualVirtualSupplyOverrideDisabled

Thrown whenever a manual virtual collateral supply override is attempted. IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L70

Module__BC_Discrete_Redeeming_VirtualSupply__OnlyReserveManager

Thrown when a reserve-gate selector is called by anyone other than the bound ReserveManager. IBC_Discrete_Redeeming_VirtualSupply_v1.sol#L54

Module__IssuanceBase__BuyingFunctionaltiesClosed

Buying functionalities are set to closed. IIssuanceBase_v2.sol#L18

Module__IssuanceBase__InsufficientOutputAmount

Actual buy amount is lower than the minimum acceptable amount. IIssuanceBase_v2.sol#L25

Module__IssuanceBase__InvalidDepositAmount

Deposit amount has to be larger than zero. IIssuanceBase_v2.sol#L12

Module__IssuanceBase__InvalidFeePercentage

Percentage amount is bigger than 100%, i.e. 10_000. IIssuanceBase_v2.sol#L9

Module__IssuanceBase__InvalidIssuanceToken

The issuance token is not a curve-bound token of this curve. Parameters IIssuanceBase_v2.sol#L38

Module__IssuanceBase__InvalidMinAmountOut

The minimum amount out cannot be zero. IIssuanceBase_v2.sol#L32

Module__IssuanceBase__InvalidRecipient

Receiver address can not be zero address or. Bonding Curve Funding Manager itself. IIssuanceBase_v2.sol#L22

Module__IssuanceBase__InvalidWithdrawAmount

Withdraw amount has to be larger than zero. IIssuanceBase_v2.sol#L15

Module__IssuanceBase__TradeAmountTooLow

Buy amount in relation to fee percentage to small, results in round down fee amount to zero. IIssuanceBase_v2.sol#L29

Module__RedeemingIssuanceBase__InsufficientCollateralForProjectFee

Insufficient collateral tokens are held to cover the project collateral fee. IRedeemingIssuanceBase_v2.sol#L32

Module__RedeemingIssuanceBase__SellingFunctionaltiesClosed

Selling functionalities are set to closed. IRedeemingIssuanceBase_v2.sol#L28

Module__ReferenceCurve__CapacityAboveTokenCap

Thrown when a segment update would give the curve more capacity than the issuance token cap. Parameters IReferenceCurve_v1.sol#L147

Module__ReferenceCurve__CollateralTooSmall

Thrown when collateral amount is too small to cause a price increase. Parameters IReferenceCurve_v1.sol#L72

Module__ReferenceCurve__CurveInteractionsOpen

Thrown when manual segment reconfiguration is attempted while buying or selling remains enabled. IReferenceCurve_v1.sol#L82

Module__ReferenceCurve__DisableEpochMismatch

{enableBuy} or {enableSell} was called with a disable epoch that is not the current one: a disable happened after the call was prepared. Parameters IReferenceCurve_v1.sol#L165

Module__ReferenceCurve__DisableEpochRequired

The no-argument enableBuy() and enableSell() are removed on this curve. Use enableBuy(uint256) or enableSell(uint256) with the current disable epoch. IReferenceCurve_v1.sol#L172

Module__ReferenceCurve__InsufficientPremiumSteps

Thrown when attempting to increase the referenceCurve but segment 2 has only 1 step. IReferenceCurve_v1.sol#L52

Module__ReferenceCurve__InsufficientSegments

Thrown when the segments array has fewer than 2 segments. IReferenceCurve_v1.sol#L55

Module__ReferenceCurve__InvalidReferenceSegment

Thrown when the first segment doesn’t meet referenceCurve requirements. Parameters IReferenceCurve_v1.sol#L60

Module__ReferenceCurve__InvalidSpotTolerance

Thrown when the spot tolerance is above 100% (10_000 bps). Parameters IReferenceCurve_v1.sol#L133

Module__ReferenceCurve__NoElevation

Thrown when attempting to increase referenceCurve but no collateral is actually needed. IReferenceCurve_v1.sol#L66

Module__ReferenceCurve__NoIssuanceSupply

Thrown when elevate is called before any issuance supply exists (would divide by zero in the absorption algorithm). IReferenceCurve_v1.sol#L78

Module__ReferenceCurve__RebalanceCapacityBelowSupply

Thrown when a rebalance leaves the curve capacity below the current issuance supply. Parameters IReferenceCurve_v1.sol#L104

Module__ReferenceCurve__RebalanceCollateralMismatch

Thrown when virtual collateral does not increase by exactly the supplied collateral during a rebalance. Unreachable through the production path. It is a post-condition guard, so no arguments are carried. IReferenceCurve_v1.sol#L129

Module__ReferenceCurve__RebalanceDeadlinePassed

{rebalanceSegments} ran after its deadline. Parameters IReferenceCurve_v1.sol#L176

Module__ReferenceCurve__RebalanceReferenceDecreased

Thrown when a rebalance lowers the reference price. Applies even when no issuance or reserve liabilities exist. Parameters IReferenceCurve_v1.sol#L96

Module__ReferenceCurve__RebalanceReserveDecreased

Thrown when a rebalance lowers the reserve that backs the current issuance supply (check B6). Parameters IReferenceCurve_v1.sol#L139

Module__ReferenceCurve__RebalanceSpotDecreased

Thrown when a rebalance lowers the spot price at the current issuance supply (LRE Stage 1, I3). Parameters IReferenceCurve_v1.sol#L112

Module__ReferenceCurve__RebalanceSpotMoved

Thrown when a rebalance raises the spot price at the current supply by more than the spot tolerance (B4). Parameters IReferenceCurve_v1.sol#L121

Module__ReferenceCurve__RebalanceStateMismatch

The curve state is not the state that {rebalanceSegments} was prepared for. A retried or stale call fails closed before any collateral is pulled. Parameters IReferenceCurve_v1.sol#L186

Module__ReferenceCurve__ReconfigureReserveDecreased

Thrown when a manual {reconfigureSegments} lowers the reserve that backs the current issuance supply. The keeper rule B6 also applies to manual changes. Parameters IReferenceCurve_v1.sol#L156

Module__ReferenceCurve__ReferencePriceCannotDecrease

Thrown when a reconfiguration would lower the reference floor while issuance-token or outstanding-reserve liabilities exist. Parameters IReferenceCurve_v1.sol#L88

Module__VirtualCollateralSupplyBase__AddResultsInOverflow

Adding would result in and overflow. IVirtualCollateralSupplyBase_v1.sol#L25

Module__VirtualCollateralSupplyBase__SubtractResultsInUnderflow

IVirtualCollateralSupplyBase_v1.sol#L22

Module__VirtualCollateralSupplyBase__VirtualSupplyCannotBeZero

The virtual supply cannot be zero. IVirtualCollateralSupplyBase_v1.sol#L19

ReferenceCurve__ControllerAlreadySet

Parameters IReferenceCurve_v1.sol#L30

ReferenceCurve__ControllerMismatch

Parameters IReferenceCurve_v1.sol#L40

ReferenceCurve__ControllerOnly

Parameters IReferenceCurve_v1.sol#L34

ReferenceCurve__ControllerZero

IReferenceCurve_v1.sol#L29

ReferenceCurve__EndowmentDrawExceedsReferenceValue

Parameters IReferenceCurve_v1.sol#L37

ReferenceCurve__OutstandingDrawsOnReopen

Parameters IReferenceCurve_v1.sol#L36

ReferenceCurve__ReferenceSellsClosed

IReferenceCurve_v1.sol#L35

ReferenceCurve__ReserveManagerOnly

Parameters IReferenceCurve_v1.sol#L31

ReferenceCurve__SetupStateInvalid

Parameters IReferenceCurve_v1.sol#L28