Encumbra
Menu

Contract: views and events

Read-only views and the events the contract emits.

Views

Public read-only functions for clients, gateways, and financed devices.

getLien(id)
Returns the full Lien struct.
available(id)
Spendable headroom right now; 0 when inactive, frozen, or past due.
isServiceable(id)
Whether a provider should keep serving: active, not frozen, not past due, and with headroom.
isAssetEnabled(id)
Whether a leased asset should operate; unlike isServiceable it does not require spare headroom, so a fully-drawn lease stays enabled.
collateralValue(id)
Collateral worth in debt-token units: oracle-priced for ERC-20, appraised for a non-fungible token.
healthFactor(id)
The collateralization ratio in WAD (1e18 is 100%); maximal when debt is zero.
isLiquidatable(id)
Whether the lien is past due or underwater against its liquidation threshold.
chainId()
The chain id baked into the EIP-712 domain, for off-chain signers.
agentStats(agent)
The public mapping of an agent's repayment history: liens opened with this agent, liens settled and defaulted, liens closed after being late (liensCuredLate), plus cumulative repaid and bad debt. The owner who opens a lien names the agent, with no consent from that agent, so a third party can inflate or poison the record. The contract notes it is sybil-forgeable. Treat it as a reference signal and do not drive real credit limits from it.

Several configuration values are public state and exposed as auto-generated getters:

  • Configuration: admin, treasury, oracle, protocolFeeBps, keeperRewardBps, and usageFeeBps.
  • Counters: nextId and chargeNonce, the per-lien nonce.
  • Constants: MAX_FEE_BPS and WAD, plus the immutable DOMAIN_SEPARATOR.

Events

Every lien verb and setParams emits an event. Two admin calls, setOracle and transferAdmin, emit none. The events are:

  • LienOpened — a new lien is created (both open and openAsset).
  • Charged — usage recorded against the line.
  • Repaid — debt paid down to the creditor and protocol.
  • CollateralAdded — collateral topped up.
  • Frozen and Unfrozen — the kill-switch toggled.
  • Liquidated — a default enforced, carrying the full waterfall breakdown.
  • Closed — a settled lien closed and collateral released.
  • ParamsUpdated — admin changed fees or the treasury.
  • AssetEscrowed and AssetRepossessed — a non-fungible token title taken in and later handed to a keeper.
  • LeaseScheduled and InstallmentPaid — installment schedule set and serviced.

The sticky everPastDue flag is set inside repay, payInstallment, and close with no event of its own. Oracle rotation and admin transfer are visible only by reading the oracle and admin getters or the transaction history.