An escrow contract serves instead of the middleman between a vendor and a client. A client creates an escrow on the smart contract and the vendor fulfills it. The contract releases the funds (ERC-20 or ERC-721) when the escrow conditions are fulfilled. Escrow has a deadline. Either client or vendor can cancel escrow under certain conditions.
Owner-only method to register new tokens that can be exchanged using escrow.
The client calls this method to create an escrow where they pay with ETH. They must provide details about the tokens they expect in return, details about the vendor that can fulfill this escrow and the expiration date.
The client calls this method to create an escrow where they offer ERC-20 or ERC-721 tokens. They must provide details about the tokens they expect in return, details about the vendor that can fulfill this escrow and the expiration date.
The vendor calls this method to fulfill an escrow. The call requires payment in ETH.
The vendor calls this method to fulfill an escrow with ERC-20 or ERC-721 token.
Using this method, the client can create an escrow cancelation request. In case escrow was already fulfilled the vendor can approve or decline the request. Client instantly gets back their tokens if the escrow was not yet fulfilled.
The vendor approves the cancelation request. Both client and vendor receive their tokens back.
The vendor declines the cancelation request. The escrow is fulfilled. The vendor receives tokens sent by the client and vice versa.
The client can commit escrow if it was successfully fulfilled by the vendor. The client receives tokens sent by the vendor and vice versa.
The vendor can commit escrow if it has expired. The vendor receives tokens sent by the client and vice versa.
Get escrow details.
Examples are available in the test folder.