PerpetualEndowment.sol
The mathematical core of the AetherCycle protocol; a locked, autonomous treasury providing perpetual baseline funding to the PerpetualEngine.
Quick Links
Contract Path:
contracts/core/Endowment.sol
Inherits From
ReentrancyGuardIPerpetualEndowment
Key State Variables
Public and immutable variables defining the core mechanics, release schedule, and state of the Endowment.
aecToken
IERC20
Immutable address of the AEC token contract.
perpetualEngine
address
Immutable address of the PerpetualEngine, the sole recipient of released funds.
initialEndowmentAmount
uint256
The exact initial amount of AEC (311,111,111) required to seal the contract.
deploymentTime
uint256
Immutable timestamp of the Endowment's deployment.
isSealed
bool
Becomes true after initialize() is called, permanently locking the funds.
releaseInfo
struct ReleaseInfo
Struct tracking release history and state: lastReleaseTime, totalReleased, releaseCount, lastReleaseAmount.
releaseInterval
uint256
Time in seconds between release periods; defaults to 30 days but is adjustable by the Engine.
compoundingEnabled
bool
Returns true if the release calculation uses a compound interest formula; can be toggled by the Engine.
monthlyReleases
mapping(uint256 => uint256)
Mapping for analytics, tracking total AEC released per month (key = (block.timestamp - deploymentTime) / 30 days).
releaseHistory
uint256[]
Array storing the amount of each individual release for historical analysis.
Write Functions
Functions that modify the state of the contract; highly restricted.
initialize()
Public
One-time function to seal the Endowment after verifying initialEndowmentAmount. Cannot be called again.
emergencyRelease()
Public
Failsafe that allows anyone to trigger a release if the last one was over 180 days ago, ensuring the protocol never halts.
releaseFunds()
Engine-Only
Called by the PerpetualEngine to release AEC based on the 0.5% monthly decay. Reverts if no release is due.
updateReleaseInterval(uint256 newInterval)
Engine-Only
Adjusts release frequency; bounded by MIN_RELEASE_INTERVAL (1 day) and MAX_RELEASE_INTERVAL (90 days).
setCompoundingEnabled(bool enabled)
Engine-Only
Toggles the release calculation between a compound or simple interest formula for economic flexibility.
View Functions
Read-only functions for monitoring the long-term health and sustainability of the protocol.
suggestOptimalRelease()
Returns whether a release is due, the potential amount, and a “gas efficiency score” for economically optimal calls.
getEndowmentStatus()
Provides current balance, total released, number of releases, and next expected release details.
projectFutureBalance(uint256 monthsAhead)
Projects remaining Endowment balance months into the future to demonstrate sustainability.
getCurrentAPR()
Calculates estimated Annual Percentage Rate based on recent releases compared to initialEndowmentAmount.
getReleaseHistory(uint256 offset, uint256 limit)
Returns a paginated array of past release amounts for analytics.
healthCheck()
Returns isHealthy (bool) and a string describing the current operational state.
verifyMathematicalSustainability(uint256 yearsToCheck)
Formally verifies sustainability; returns true if projected balance after yearsToCheck remains above threshold.
Events
Events emitted for monitoring and off-chain tracking.
EndowmentInitialized(uint256 amount, uint256 timestamp)
Emitted once when the contract is sealed, marking the start of perpetual funding.
FundsReleased(uint256 amount, uint256 periodsProcessed, uint256 remainingBalance)
Emitted each time releaseFunds() is successfully called, providing a transparent record of all funds flowing into the active economy.
EmergencyReleaseTriggered(address indexed caller, uint256 amount)
Emitted when the emergencyRelease() function is successfully triggered after a long period of inactivity.
ReleaseIntervalUpdated(uint256 oldInterval, uint256 newInterval)
Emitted when the Engine adjusts the release interval.
CompoundingEnabled(bool status)
Emitted when the Engine toggles the compounding calculation method.
Closing Note
This reference completes the overview for PerpetualEndowment.sol. All functions, state variables, and events are documented above for verification, integration, and direct developer usage.
Last updated