LendingProtectionSuiteBase
Inherits: ForkUtils, ILendingProtectionSuite
Title: LendingProtectionSuiteBase
Author: Phylax Systems
Shared default implementations for lending protection suites.
Functions
getConsumptionChecks
Default bounded-consumption implementation for suites with no extra resource checks.
Override this when the protocol needs withdraw, liquidation, or other consumption bounds. Returning an empty array keeps solvency-only suites source-compatible with the generic lending assertion.
function getConsumptionChecks(
TriggeredCall calldata triggered,
OperationContext calldata operation,
PhEvm.ForkId calldata beforeFork,
PhEvm.ForkId calldata afterFork
) external view virtual override returns (ConsumptionCheck[] memory checks);
Parameters
| Name | Type | Description |
|---|---|---|
triggered | TriggeredCall | The exact adopter frame that caused the assertion to run. |
operation | OperationContext | The decoded operation context. |
beforeFork | PhEvm.ForkId | The pre-call snapshot fork. |
afterFork | PhEvm.ForkId | The post-call snapshot fork. |
Returns
| Name | Type | Description |
|---|---|---|
checks | ConsumptionCheck[] | Empty by default. |
getAccountSnapshot
Composes a full account snapshot from the step-oriented suite functions.
This is the default implementation for step-based suites. Override it only when the
protocol exposes a materially cheaper or more direct way to answer the invariant than
calling getAccountState(...), getAccountBalances(...), and evaluateSolvency(...)
separately.
function getAccountSnapshot(address account, PhEvm.ForkId calldata fork)
external
view
virtual
override
returns (AccountSnapshot memory snapshot);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account whose post-operation state should be read. |
fork | PhEvm.ForkId | The snapshot fork to query. |
Returns
| Name | Type | Description |
|---|---|---|
snapshot | AccountSnapshot | Aggregate state, balances, and solvency produced by the suite steps. |
_viewFailureMessage
Returns the suite-specific revert string for failed fork-time static calls.
function _viewFailureMessage() internal pure virtual override returns (string memory);