Skip to content

thodges-gh/OracleEscrow

Repository files navigation

Oracle Escrow Contract

The Oracle Escrow contract works much like a traditional escrow agreement in that it allows for a depositor to safely pay a beneficiary when the terms of the contract have been met. However, it removes the need for trusting the agent with the escrow funds. The agent, which is the owner of the contract, has no control over the funds once the contract has been deployed. The agent may be changed, or even removed completely, and the contract will still execute based on its terms. But only the agent may read the value at the oracle contract and only the depositor may place the escrow funds.

The contract makes use of the Ethereum oracle contract at SmartContract.com. It allows for the value read from the oracle contract to determine execution of payment. When this contract is deployed, it should have an expected value and expiration date set that all parties agree on. Before making a deposit, all parties may inspect the publicly visible expected value and expiration date.

The contract may only be executed by the agent (owner), depositor, or beneficiary. If the expected value is the same as what is read from the oracle contract, the escrow funds go to the beneficiary. If the expiration date has passed and the expected value has still not been met, the depositor is refunded. However, if the expiration date has passed and the expected value has been met, the escrow will still go to the beneficiary.

Deployment Parameters

  • Oracle contract address
  • Depositor address
  • Beneficiary address

Values to change

Only two values should be changed by the agent when deploying the contract:

  • EXPECTED - the expected value that the oracle contract should read.
  • TO_EXPIRE - the number of days after the contract has been deployed for it to expire.

These should be inspected by the depositor and beneficiary before depositing to, or using the contract.

Building

$ npm install
$ truffle compile

Testing

$ ./node_modules/.bin/ganache-cli
$ truffle test --network development

Solium lint

$ npm run-script lint:sol

JavaScript lint

$ npm run-script lint

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published