Skip to content

Commit

Permalink
Made the possibility to use a hash instead of encryption more explici…
Browse files Browse the repository at this point in the history
…ty in the documentation.
  • Loading branch information
cfries committed Feb 1, 2025
1 parent 92abd04 commit 991b1bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions ERCS/erc-7573.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function inceptTransfer(bytes32 id, int amount, address from, string memory keyE

Called from the buyer of the token to initiate token transfer. Emits a `TransferIncepted` event.
The parameter `id` is an identifier of the trade. The parameter `from` is the address of the seller (the address of the buyer is `msg.sender`).
The parameter `keyEncryptedSeller` is an encryption of the key that can be used by the seller to (re-)claim the token. See below on "encryption".
The parameter `keyEncryptedSeller` is an encryption (or, alternatively, hash) of the key that can be used by the seller to (re-)claim the token. See below on "encryption".

##### Initiation of Transfer: `confirmTransfer`

Expand All @@ -62,7 +62,7 @@ function confirmTransfer(bytes32 id, int amount, address to, string memory keyEn

Called from the seller of the token to confirm token transfer. Emits a `TransferConfirmed` event.
The parameter `id` is an identifier of the trade. The parameter `to` is the address of the buyer (the address of the seller is `msg.sender`).
The parameter `keyEncryptedBuyer` is an encryption of the key that can be used by the buyer to claim the token.
The parameter `keyEncryptedBuyer` is an encryption (or, alternatively, hash) of the key that can be used by the buyer to claim the token.

If the trade specification, that is, the quadruppel (`id`, `amount`, `from`, `to`), in a call to `confirmTransfer`
matches that of a previous call to `inceptTransfer`, and the balance is sufficient, the corresponding `amount`
Expand Down Expand Up @@ -185,6 +185,11 @@ It is implicitly assumed that the two parties may check that
the strings `keyEncryptedBuyer` and `keyEncryptedSeller` are
in a valid format.

To avoid on chain encryption in the `ILockingContract`, it is possible to use a simpler hashing algorithm
on the `ILockingContract`. In that case, the decryption oracle has
to provide a method that allows to obtain the hash *H(K)* for an
encrypted key *E(K)* without exposing the key *K*, cf. [^2].

### Sequence diagram of delivery versus payment

The interplay of the two smart contracts is summarized
Expand Down
10 changes: 5 additions & 5 deletions assets/erc-7573/contracts/ILockingContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pragma solidity >=0.7.0;
* This is the locking contracts interface.
*
* The rationale is that the token is locked with with two encrypted keys
* or a hashes of keys associated with two different adresses (buyer/seller).
* or hashes of keys associated with two different adresses (buyer/seller).
*
* The asset in transfered to the address of the buyer, if the buyer's key is presented.
*
Expand All @@ -31,7 +31,7 @@ interface ILockingContract {
* @param id the trade identifier of the trade.
* @param from The address of the seller.
* @param to The address of the buyer.
* @param keyEncryptedSeller Encryption of the key that can be used by the seller to (re-)claim the token.
* @param keyEncryptedSeller Encryption (or, alternatively, hash) of the key that can be used by the seller to (re-)claim the token.
*/
event TransferIncepted(bytes32 id, int amount, address from, address to, string keyEncryptedSeller);

Expand All @@ -41,7 +41,7 @@ interface ILockingContract {
* @param amount the number of tokens to be transfered.
* @param from The address of the seller.
* @param to The address of the buyer.
* @param keyEncryptedBuyer Encryption of the key that can be used by the buyer to claim the token.
* @param keyEncryptedBuyer Encryption (or, alternatively, hash) of the key that can be used by the buyer to claim the token.
*/
event TransferConfirmed(bytes32 id, int amount, address from, address to, string keyEncryptedBuyer);

Expand All @@ -67,7 +67,7 @@ interface ILockingContract {
* @param id the trade identifier of the trade.
* @param amount the number of tokens to be transfered.
* @param from The address of the seller (the address of the buyer is message.sender).
* @param keyEncryptedSeller Encryption of the key that can be used by the seller to (re-)claim the token.
* @param keyEncryptedSeller Encryption (or, alternatively, hash) of the key that can be used by the seller to (re-)claim the token.
*/
function inceptTransfer(bytes32 id, int amount, address from, string memory keyEncryptedSeller) external;

Expand All @@ -77,7 +77,7 @@ interface ILockingContract {
* @param id the trade identifier of the trade.
* @param amount the number of tokens to be transfered.
* @param to The address of the buyer (the address of the seller is message.sender).
* @param keyEncryptedBuyer Encryption of the key that can be used by the buyer to claim the token.
* @param keyEncryptedBuyer Encryption (or, alternatively, hash) of the key that can be used by the buyer to claim the token.
*/
function confirmTransfer(bytes32 id, int amount, address to, string memory keyEncryptedBuyer) external;

Expand Down

0 comments on commit 991b1bb

Please sign in to comment.