Presale module orchestrating presale buying with optional looped positions, fees and vesting. Source: src/core/modules/Presale_v1.sol. Interfaces: IPresale_v1, IDecayingFeeMultiplierBase_v1, IPresaleClaimObligations_v1, IMerkleWhitelistBase_v1.

Functions

addToWhitelistWithProof

Allows msg.sender to self-register by providing a valid proof. Parameters IMerkleWhitelistBase_v1.sol#L72

buyPresale

Buys into the presale without loops (direct purchase). Parameters Returns IPresale_v1.sol#L381

buyPresaleWithLoops

Buys into the presale with buy-borrow loops. Parameters Returns IPresale_v1.sol#L398

claimAll

Claims all unlocked tranches from a position. Parameters IPresale_v1.sol#L414

setBaseCommissionBpsAndPriceBreakpoints

Sets the base commission array and price breakpoints. Parameters IPresale_v1.sol#L460

setCaps

Sets the issuance caps. Parameters IPresale_v1.sol#L448

setCreditFacility

Sets the credit facility address. Parameters IPresale_v1.sol#L440

setDecayDuration

Sets the decay duration. Parameters IDecayingFeeMultiplierBase_v1.sol#L103

setEndTimestamp

Sets the end timestamp. Parameters IPresale_v1.sol#L455

setInitialMultiplier

Sets the initial multiplier. Parameters IDecayingFeeMultiplierBase_v1.sol#L99

setMerkleRoot

Sets the merkle root for whitelist verification. Parameters IMerkleWhitelistBase_v1.sol#L60

setPresaleState

Sets the presale state. Parameters IPresale_v1.sol#L429

setStartTime

Manually sets the start time (for scheduling or manual control). Parameters IDecayingFeeMultiplierBase_v1.sol#L107

View functions

getBaseCommissionBps

Returns the base commission array (indexed by loop count). Returns IPresale_v1.sol#L301

getCreditFacility

Returns the credit facility address. Returns IPresale_v1.sol#L278

getDecayDuration

Returns the decay duration (in seconds). Returns IDecayingFeeMultiplierBase_v1.sol#L79

getEndTimestamp

Returns the end timestamp. Returns IPresale_v1.sol#L297

getGlobalIssuance

Returns the global cumulative issuance. Returns IPresale_v1.sol#L336

getGlobalIssuanceCap

Returns the global issuance cap (0 disables). Returns IPresale_v1.sol#L284

getInitialMultiplier

Returns the initial multiplier (in bps). Returns IDecayingFeeMultiplierBase_v1.sol#L72

getIssuanceBy

Returns issuance by a specific address. Parameters Returns IPresale_v1.sol#L341

getMerkleRoot

Returns the current merkle root for whitelist verification. Returns IMerkleWhitelistBase_v1.sol#L65

getMultiplier

Returns the current fee multiplier (in bps). Returns IDecayingFeeMultiplierBase_v1.sol#L68

getPendingLoanClaimCount

Returns the number of stored loan IDs still awaiting claims. Returns IPresaleClaimObligations_v1.sol#L39

getPerAddressIssuanceCap

Returns the per-address issuance cap (0 disables). Returns IPresale_v1.sol#L290

getPosition

Returns a position by ID. Parameters Returns IPresale_v1.sol#L319

getPositionCount

Returns the number of positions created. Returns IPresale_v1.sol#L332

getPositionsByOwner

Returns all position ids owned by an address. Parameters Returns IPresale_v1.sol#L325

getPositionState

Returns tranche state for a given position and tranche index. Parameters Returns IPresale_v1.sol#L351

getPresaleState

Returns the current presale state. Returns IPresale_v1.sol#L271

getPriceBreakpoints

Returns the price breakpoints array. Returns IPresale_v1.sol#L308

getStartTime

Returns the auction start time (timestamp). Returns IDecayingFeeMultiplierBase_v1.sol#L83

getUserTotalTokens

Returns aggregate claimable/locked/claimed tokens for a user across all positions. Parameters Returns IPresale_v1.sol#L362

isActive

Returns whether the auction is currently active (started and not yet ended). Returns IDecayingFeeMultiplierBase_v1.sol#L88

isEnded

Returns whether the auction has ended (multiplier = 1x). Returns IDecayingFeeMultiplierBase_v1.sol#L92

isMerkleWhitelisted

Checks if an address is registered via Merkle proof. Parameters Returns IMerkleWhitelistBase_v1.sol#L79

isPurchaseInProgress

Returns whether a loan-producing purchase is in progress. Returns IPresaleClaimObligations_v1.sol#L47

Events

BaseCommissionUpdated

Base commission array has been updated. Parameters IPresale_v1.sol#L202

CapsUpdated

Caps have been updated. Parameters IPresale_v1.sol#L207

CreditFacilitySet

Credit facility has been set. Parameters IPresale_v1.sol#L219

DecayDurationUpdated

Emitted when the decay duration is updated. Parameters IDecayingFeeMultiplierBase_v1.sol#L39

DirectTokensClaimed

Direct issuance tokens have been claimed for a position. Parameters IPresale_v1.sol#L253

EndTimestampSet

End timestamp has been set. Parameters IPresale_v1.sol#L211

FeeMultiplierDecayReset

Emitted when the fee multiplier auction is reset. IDecayingFeeMultiplierBase_v1.sol#L46

FeeMultiplierDecayStarted

Emitted when the fee multiplier auction is started. Parameters IDecayingFeeMultiplierBase_v1.sol#L43

InitialMultiplierUpdated

Emitted when the initial multiplier is updated. Parameters IDecayingFeeMultiplierBase_v1.sol#L32

MerkleRootUpdated

Merkle root has been updated. Parameters IMerkleWhitelistBase_v1.sol#L45

MerkleWhitelistRegistered

User has self-registered via Merkle proof. Parameters IMerkleWhitelistBase_v1.sol#L49

PositionCreated

A position has been created. Parameters IPresale_v1.sol#L242

PresaleBought

A presale purchase has been made. Parameters IPresale_v1.sol#L228

PresaleReopened

Presale has been reopened from a closed/ended state. Parameters IPresale_v1.sol#L198

PresaleStateSet

Presale state has been set. Parameters IPresale_v1.sol#L193

PriceBreakpointsSet

Price breakpoints have been set. Parameters IPresale_v1.sol#L215

TrancheClaimed

A loan tranche has been claimed (loan transferred to owner). Parameters IPresale_v1.sol#L259

Errors

Module__DecayingFeeMultiplierBase__AlreadyStarted

Thrown when trying to start an already started auction. IDecayingFeeMultiplierBase_v1.sol#L58

Module__DecayingFeeMultiplierBase__InvalidDecayDuration

Thrown when decay duration is zero. IDecayingFeeMultiplierBase_v1.sol#L55

Module__DecayingFeeMultiplierBase__InvalidInitialMultiplier

Thrown when initial multiplier is below 1x (10000 bps). IDecayingFeeMultiplierBase_v1.sol#L52

Module__DecayingFeeMultiplierBase__NotStarted

Thrown when trying to reset an auction that hasn’t started. IDecayingFeeMultiplierBase_v1.sol#L61

Module__MerkleWhitelistBase__AlreadyWhitelisted

Address is already registered via Merkle proof. IMerkleWhitelistBase_v1.sol#L37

Module__MerkleWhitelistBase__MerkleRootNotSettable

Merkle root can only be set before presale starts. IMerkleWhitelistBase_v1.sol#L31

Module__MerkleWhitelistBase__NotWhitelisted

Whitelist verification failed. IMerkleWhitelistBase_v1.sol#L34

Presale__ActiveClaimObligations

Claims or loan-producing purchase creation are active. IPresaleClaimObligations_v1.sol#L31

Presale__AfterEndTimestamp

Presale has ended (past endTimestamp). IPresale_v1.sol#L93

Presale__CannotModifyAfterStart

Price breakpoints or base commission cannot be modified after presale has started. IPresale_v1.sol#L177

Presale__ClaimPermissionNotConfigured

The Presale is not admitted with the configured CreditFacility and ordinary transfer permission. IPresaleClaimObligations_v1.sol#L28

Presale__CreditFacilityMarketMismatch

CreditFacility curve or authorizer differs from this Presale. Parameters IPresale_v1.sol#L127

Presale__EndTimestampAlreadyElapsed

End timestamp has already elapsed and is frozen; it cannot be moved forward or reset, which would re-lock claimable tranches. IPresale_v1.sol#L134

Presale__FeeExceedsDeposit

Adjusted fee equals or exceeds the deposit amount. Parameters IPresale_v1.sol#L182

Presale__GlobalCapExceeded

Global issuance cap would be exceeded. Parameters IPresale_v1.sol#L102

Presale__InvalidBps

Invalid basis points value (must be <= 10000). Parameters IPresale_v1.sol#L117

Presale__InvalidEndTimestamp

End timestamp must be in future. IPresale_v1.sol#L130

Presale__InvalidLoopCount

Invalid loop count (must be within fee array bounds). Parameters IPresale_v1.sol#L152

Presale__InvalidPosition

Position does not exist. Parameters IPresale_v1.sol#L138

Presale__InvalidTranche

Tranche does not exist or index out of bounds. Parameters IPresale_v1.sol#L143

Presale__InvalidTransition

Invalid state transition. Parameters IPresale_v1.sol#L166

Presale__MerkleRootNotSet

The Whitelist state was requested while the Merkle root is zero. Set the root before the presale starts. IPresale_v1.sol#L186

Presale__NotEnded

Presale has not ended yet. IPresale_v1.sol#L120

Presale__NoTokensMinted

A looped buy minted zero tokens (e.g. the curve was already at capacity); reverted so the presale fee is not kept for a no-op. IPresale_v1.sol#L161

Presale__NotOpen

Presale is not open for deposits. IPresale_v1.sol#L90

Presale__NotStarted

Presale has not started yet. IPresale_v1.sol#L123

Presale__NotWhitelisted

Caller is not whitelisted. IPresale_v1.sol#L96

Presale__PerAddressCapExceeded

Per-address issuance cap would be exceeded. Parameters IPresale_v1.sol#L111

Presale__SlippageExceeded

Slippage protection: tokens minted below minimum. Parameters IPresale_v1.sol#L157

Presale__TrancheNotClaimable

Tranche is not yet claimable. Parameters IPresale_v1.sol#L148

Presale__Unsorted

Price breakpoints are not non-decreasing. Parameters IPresale_v1.sol#L170