Escrow Creation

The SCEA is created once for each liquidity provider (LP), providing a persistent address for their transactions on the platform.

The LP creates the escrow using their non-custodial wallet, which holds the owner EOA attribute on the SCEA. Two other EOA attributes are assigned to the SCEA at creation:

  • Initiator: Responsible for order initiation and locking funds in escrow.
  • Mediator: Handles order confirmation and dispute resolution.

Locking assets during transactions

Onramp Order

An onramp is a transaction where an external buyer (customer) wants to purchase assets from the LP, stored in the SCEA’s AvailableBalance (i.e. assets not locked in an order).

  • Initiation: The owner or initiator locks the specified quantity of crypto assets in the SCEA, ensuring it doesn’t exceed the AvailableBalance, computed as the Total balance - Total locked balance for the token being transacted. The owner may grant the initiator permission to lock assets in order to ensure timely execution of onramp orders.
  • Confirmation: The buyer transfers the fiat or other asset being exchanged for the locked token outside the platform. Upon confirmation of receipt by the LP, the locked assets are released to the customer’s address.
  • Cancellation: Locked funds are released from LockBalance and returned to the LP’s AvailableBalance.

Offramp Order

An offramp is a transaction where an external seller (customer) wants to sell assets in their non-custodial wallet to the Liquidity Provider.

  • Initiation: The customer sends the specified quantity of crypto assets to the LP’s SCEA, locking the amount in the escrow. For ERC-20 tokens, the customer must approve the LP’s SCEA to spend the quantity they wish to offramp.
  • Confirmation: The seller (LP in this case) transfers the fiat or other asset being exchanged for the locked token outside the platform. Upon confirmation of receipt by the customer, the locked assets in the LP’s SCEA are released to the LP’s AvailableBalance.
  • Cancellation: Locked funds are released from LockBalance and returned to the customer’s non-custodial wallet address.

Flow Diagram

Escrow Interaction Flow