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!
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).
- Bob wants to change his 1 ETH to Alice 1 ERC20 token.
- Alice sends dexfee (handled externally by client side).
- Bob sends payment locked with hash of the Secret. He can refund the payment in 4 hours.
- Alice sends payment locked with Bob Secret hash. She can refund her payment in 2 hours.
- Bob spends Alice payment by revealing the secret.
- Alice spends Bob payment using revealed secret.
contracts
- Smart Contracts source code.test
- Smart contracts unit tests.
- Install docker.
- Run
docker-compose build
. cp .env.empty .env
.- Start containers
docker-compose up -d
. - Install project dependencies:
docker-compose exec workspace yarn
. - To run tests:
docker-compose exec workspace truffle test
.
- Komodo platform - https://www.komodoplatform.com
- Truffle suite - https://github.com/trufflesuite/truffle
- Ganache-cli (EthereumJS Testrpc) - https://github.com/trufflesuite/ganache-cli
- Zeppelin Solidity - https://github.com/OpenZeppelin/zeppelin-solidity