Etomic Swap Smart Contracts for BarterDex platform.
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.
How to setup dev environment?
- Install docker.
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