Skip to content

Etomic Swap Smart Contract allowing EVM atomic swaps on Komodo SDK.

Notifications You must be signed in to change notification settings

r2st/etomic-swap

 
 

Repository files navigation

Etomic Swap Smart Contracts for BarterDex platform.

Build Status
Etomic swap Smart Contract is implemented to support ETH and ERC20 atomic swaps on BarterDex platform. Please note that this project is not production ready yet!

Swap workflow

Smart Contracts follow standard symmetric Atomic swap protocol.
Despite example shows swap of ETH/ERC20 this approach will work also for ETH/ERC20 swaps to any currency supporting HTLC (https://en.bitcoin.it/wiki/Hashed_Timelock_Contracts).

  1. Bob wants to change his 1 ETH to Alice 1 ERC20 token.
  2. Alice sends dexfee (handled externally by client side).
  3. Bob sends payment locked with hash of the Secret. He can refund the payment in 4 hours.
  4. Alice sends payment locked with Bob Secret hash. She can refund her payment in 2 hours.
  5. Bob spends Alice payment by revealing the secret.
  6. Alice spends Bob payment using revealed secret.

Project structure

  1. contracts - Smart Contracts source code.
  2. test - Smart contracts unit tests.

How to setup dev environment?

  1. Install docker.
  2. Run docker-compose build.
  3. cp .env.empty .env.
  4. Start containers docker-compose up -d.
  5. Install project dependencies: docker-compose exec workspace yarn.
  6. To run tests: docker-compose exec workspace truffle test.

Related links

  1. Komodo platform - https://www.komodoplatform.com

Useful links for smart contracts development

  1. Truffle suite - https://github.com/trufflesuite/truffle
  2. Ganache-cli (EthereumJS Testrpc) - https://github.com/trufflesuite/ganache-cli
  3. Zeppelin Solidity - https://github.com/OpenZeppelin/zeppelin-solidity

About

Etomic Swap Smart Contract allowing EVM atomic swaps on Komodo SDK.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 67.2%
  • Solidity 31.8%
  • Dockerfile 1.0%