Escrow Management

Crypto Token Escrow is a React/Nextjs-based single-page application with no backend. It performs all its actions from the front end. But it is secure also. It uses IPFS/Filecoin decentralized object storage through Web3Storage to store metadata and other files. And all the queries and mutations to the smart contract you deployed before.

Let us describe the escrow lifecycle and properties.

  • Every Escrow has some properties. An escrow belongs to two different parties, the first party (buyer) and the second party (seller).

    • First party (buyer): Who creates/places a new escrow with other details.
    • Second party (seller): Seller address that the buyer (first party) provided while creating the escrow.
  • Escrow title and description are metadata for an escrow where the title is required but the description is optional.

  • Ether amount will be provided by the buyer/first party while creating escrow inclusively and will be calculated and divided into two parts. The fee (the owner will receive upon fund clearance) and the actual amount the seller will receive if no refund happens. The entered amount will be transferred to the escrow from the buyer/first party's account while creating escrow.

  • The expiration time determines when the Escrow will be expired. After expiration, if the escrow is still in the initial state then the seller (2nd party) can claim the fund on his/her own.

  • An Escrow can have multiple statuses.

    • The initial status is Awaiting Delivery just after the buyer created the escrow. The buyer can deliver funds at any time when the escrow is in Awaiting Delivery state. App owner and escrow seller can refund the buyer at any time in Awaiting Delivery state. All the actions must perform only in this state. Others' status will behave like stalled actually.
    • When the buyer delivers the funds, the state will change to COMPLETED. In this state, there are no actions that can perform on Escrow.
    • After creating escrow, the owner or the seller (second party) can refund the buyer at any time in Awaiting Delivery** state. After the refund transaction, the escrow state will change to the Refunded state.
    • After expiration time, if the escrow is still in Awaiting Delivery state, then the seller can claim the fund on their own. After a successful claim transaction, the escrow state will change to Claim after Expire state.

Whether the buyer (first party) delivers the fund or the seller (2nd party) claims the fund after expiration, the escrow fee will be transferred to the owner/deployer wallet address and the actual amount will be transferred to the seller. But, if the Owner or the seller performs the refund then the whole amount (fee+escrow amount) will be refunded to the buyer's (first party) wallet address.