You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-14Lines changed: 17 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,25 @@
4
4
5
5
[Hashed Timelock Contracts](https://en.bitcoin.it/wiki/Hashed_Timelock_Contracts) (HTLCs) for Ethereum:
6
6
7
-
*[HashedTimelock.sol](contracts/HashedTimelock.sol) - HTLC for native ETH token
8
-
*[HashedTimelockERC20.sol](contracts/HashedTimelockERC20.sol) - HTLC for ERC20 tokens
7
+
-[HashedTimelock.sol](contracts/HashedTimelock.sol) - HTLC for native ETH token
8
+
-[HashedTimelockERC20.sol](contracts/HashedTimelockERC20.sol) - HTLC for ERC20 tokens
9
9
10
10
Use these contracts for creating HTLCs on the Ethereum side of a cross chain atomic swap (for example the [xcat](https://github.com/chatch/xcat) project).
1.`newContract(receiverAddress, hashlock, timelock)` create new HTLC with given receiver, hashlock and expiry; returns contractId bytes32
49
-
2.`withdraw(contractId, preimage)` claim funds revealing the preimage
50
-
3.`refund(contractId)` if withdraw was not called the contract creator can get a refund by calling this some time after the time lock has expired.
51
+
1.`newContract(receiverAddress, hashlock, timelock)` create new HTLC with given receiver, hashlock and expiry; returns contractId bytes32
52
+
2.`withdraw(contractId, preimage)` claim funds revealing the preimage
53
+
3.`refund(contractId)` if withdraw was not called the contract creator can get a refund by calling this some time after the time lock has expired.
51
54
52
55
See [test/htlc.js](test/htlc.js) for examples of interacting with the contract from javascript.
53
56
54
57
### HashedTimelockERC20
55
58
56
-
1.`newContract(receiverAddress, hashlock, timelock, tokenContract, amount)` create new HTLC with given receiver, hashlock, expiry, ERC20 token contract address and amount of tokens
57
-
2.`withdraw(contractId, preimage)` claim funds revealing the preimage
58
-
3.`refund(contractId)` if withdraw was not called the contract creator can get a refund by calling this some time after the time lock has expired.
59
+
1.`newContract(receiverAddress, hashlock, timelock, tokenContract, amount)` create new HTLC with given receiver, hashlock, expiry, ERC20 token contract address and amount of tokens
60
+
2.`withdraw(contractId, preimage)` claim funds revealing the preimage
61
+
3.`refund(contractId)` if withdraw was not called the contract creator can get a refund by calling this some time after the time lock has expired.
59
62
60
63
See [test/htlcERC20.js](test/htlcERC20.js) for examples of interacting with the contract from javascript.
0 commit comments