Hashed Timelock Contracts (HTLCs) for Ethereum:
- HashedTimelock.sol - HTLC for native ETH token
- HashedTimelockERC20.sol - HTLC for ERC20 tokens
Use these contracts for creating HTLCs on the Ethereum side of a cross chain atomic swap (for example the xcat project).
HashedTimelock:
- Kovan: 0xe196bb1e25483ed771b6691929d47943023c26fe
- Ropsten: 0x243785f6b65418191ea20b45fde7069ffe4f8cef
- Mainnet: <not deployed yet ...>
HashedTimelockERC20:
- Kovan: 0x763eedd3c04a9a2fca67ac51fc16e394472f29a2
- Ropsten: 0x16b6fabc530c7bfde69eafd9e271fb610e3fc3f7
- Mainnet: <not deployed yet ...>
newContract(receiverAddress, hashlock, timelock)
create new HTLC with given receiver, hashlock and expiry; returns contractId bytes32withdraw(contractId, preimage)
claim funds revealing the preimagerefund(contractId)
if withdraw was not called the contract creator can get a refund by calling this some time after the time lock has expired.
See test/htlc.js for examples of interacting with the contract from javascript.
newContract(receiverAddress, hashlock, timelock, tokenContract, amount)
create new HTLC with given receiver, hashlock, expiry, ERC20 token contract address and amount of tokenswithdraw(contractId, preimage)
claim funds revealing the preimagerefund(contractId)
if withdraw was not called the contract creator can get a refund by calling this some time after the time lock has expired.
See test/htlcERC20.js for examples of interacting with the contract from javascript.