---
# System prepended metadata

title: Contract Escrow
tags: [services, ideas, crypto]

---

# Contract Escrow

###### tags: `ideas`, `crypto`, `services`

The objective of this project is to design, implement, and deploy a smart contract (**Escrow Contract**) that facilitates the secure transfer of ownership of the other contract (**Transferable**) through the use of an escrow mechanism.

<br>

## The transfer flow

The smart contract will enable both parties (**Owner** and **Buyer**) involved in the transfer process to safely perform the transfer of ownership by providing a secure, transparent, and autonomous escrow service by following the steps:

- The **owner** initiates a transfer by creating a `transfer` object in the **escrow contract**. The `transfer` contains the `address` of the **transferable** contract, the `address` of **buyer** and the amount of funds in ETH required for the ownership to be transferred;



- In order to **transfer** to be created the **owner's** address must exactly match the address of the current owner of the **transferable** contract. This step is crucial for the **reverting procedure** which is executed in case if the deal did not take place and the ownership has to be given back to the **owner**;



- After the **transfer** is created sides have to perform the following actions in order to proceed the transfer:

  - From **owner's** side, the ownership of the **transferable** contract has to be transferred to the **escrow**;

  - From the **buyer's** side, the amount of ETH should be transferred to the **escrow** not less then the amount specified in the **transaction**; `**`



- After both of this requirements are met the **transaction** becomes `validated` which allows sides to complete the ownership transfer and as a result:

  - The ownership of **transferable** contract is transferred to the **buyer**;
  
  - Funds accumulated in scope of the transfer are sent to the **owner**; `*`

<br>
<br>

## Transparency

At any time the status of a transfer can be queried from the **escrow** contract providing a complete transparency of both sides, those includes:

- `Ownership is escrowed` - `true`/`false`;
- `Funds are escrowed` - `true` / `false`;

<br>

In addition to that the following block-chain events are fired allowing sides (or interested parties) to follow the transfer process:

- `TransferCreated` - is fired when the transfer is successfully created by the **owner**;
- `OwnershipEscrowed` - is fired when the **transferable** contract ownership is transferred to the **escrow** contract;
- `FundsEscrowed` - is fired when amount of funds at the **escrow** balance in scope of the **transaction** reach the amount specified by the **owner**;
- `TransferComplete`

<br>
<br>

## Reverting

At any time both of the sides can terminate a **transfer** by making a call to specific function of the **escrow** contract which will be resulted in:

- The ownership will be transferred back to the **owner**;
- Funds will be transferred back to the **buyer**;

<br>
<br>

## `*` Interest

At the stage when funds are transferred to the **owner** a service commission can be charged.

<br>
<br>

## `**` Possible extensions

The regular transfer flow can be changed in order to cover wider variety of needs, for example:

- Instead of the direct transfer to the **buyer's** address, the transfer may be performed in a form of auction, meaning that the one who have paid the most for the specific **transferable** will acquire an ownership, and the rest of propositions will be reverted;

- In addition to receive funds only from **buyer's** address the **transfer** can act as a public ledger. (The reverting procedure in this case would be more complicated so that the increase in gas consumption should be taken into account);