The SCEA is a SmartContract that lives on the Ethereum Virtual Machine and stores records of escrow data, and also holds both native and ERC-20 tokens.

SCEA Memory Model (May 2024)

The image above illustrates the SmartContract Escrow Account storage model. The storage has the following properties.

  1. Owner: the address of the LP that owns the SCEA.

  2. Initiator: the address used by the platform for transaction initiation.

  3. Mediator: the address used by the platform for transaction mediation.

  4. Escrow: this is a 3-dimensional mapping that holds the record of assets currently locked in the SCEA and unavailable for spending. It is organized by token to make lookup faster.

    • Top-level map: Maps Tokens to OrderTypes (BUY or SELL), which are represented by integers.

    • Second-level map: Under OrderType, maps either client addresses or order IDs to the locked value. For transactions via non-custodial wallets, the ClientOrderKey is a base 64 address.

      When integrated with third-party custodial exchanges, the exchange’s liquidity address might be shared by multiple users. In this case, the OrderID integer uniquely distinguishes Sell transactions initiated by each user from the third-party exchange.

  5. LockBalance: this tracks the total balance locked per token. Though this value can be computed on-the-fly by looping through the data in the Escrow, it can lead to the rapid accumulation of gas spent. This property can be incremented each time funds are locked, and decremented when funds are unlocked.