An escrow is a neutral third party that holds an asset on behalf of two parties until a transaction has occurred. Once the transaction has taken place the escrow can be resolved and the assets will be transferred as dictated by the contract. This escrow application handles the transaction between an on-chain and off-chain asset.
The off-chain asset can be anything the user desires. For example, some currency which will be used as a payment for a product or perhaps a deed to an estate. Within the blockchain world it all comes down to 1's and 0's, however, those assets can be tokenized and logic can be coded into a contract to handle different cases. But in the end, it still comes down to good faith outside of the blockchain to carry out the obligation.
For this application, the on-chain asset can be any native asset on the Fuel Network and the transaction is considered to be between a buyer and a seller. At the moment, and for the foreseeable future, there is another party (the arbiter) in case there is a dispute that the buyer and seller cannot resolve amongst themselves. More information can be found in the specification.
The project consists of a smart contract.
escrow
├── escrow-contract
│ ├── src/main.sw
│ └── tests/harness.rss
├── README.md
└── SPECIFICATION.md
TODO: The user interface does not currently exist.
In order to run the subsequent commands change into the following directory /path/to/escrow/<here>
.
forc build --locked
Before running the tests the programs must be compiled with the command above.
cargo test --locked