Earn deposits enter the pool directly. Margin operations enter AccountManager. External actions route through a Registry-approved controller and execute from SmartAccount custody. ControllerFacade exposes policy checks, while the current typed execution path reads Registry directly to reduce cost.
Risk is checked at several points, with an admin-configurable live check after external execution. Valuation snapshots can include caches. See the developer architecture diagram and contract reference.
Stellar · Introduction
Protocol Architecture
The core contracts, per-trader smart accounts and protocol controllers, and how calls flow between them.
The protocol has core accounting contracts, per-trader custody contracts, and external-protocol controllers.

