The Custodian contract is responsible for holding and safeguarding the deposited assets for all users of both the AMM pools and the orderbook. Pooling funds enables the escrow functionality that is necessary to support asynchronous trade execution and settlement.
The Custodian tracks two control contract addresses:
Exchange: the Exchange contract authorizes transfers of funds out of the Custodian
Governance: the Governance contract authorizes changing the Exchange and Governance addresses within the Custodian
The Custodian contains no additional control logic. Limiting the Custodian contract functionality allows for future upgrades without requiring users to migrate funds. Changes to either the Exchange or Governance addresses within the Custodian are managed via the Governance contract.