Skip to content

Commit

Permalink
Fixed comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfries committed Mar 7, 2024
1 parent 6431ba3 commit 00a6363
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 38 deletions.
29 changes: 14 additions & 15 deletions solidity/contracts/dvp-impl/interface/IDecryptionContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ pragma solidity >=0.7.0;
/*------------------------------------------- DESCRIPTION ---------------------------------------------------------------------------------------*/

/**
* @title ERC-DVP PAYMENT Conditional decryption of keys, conditional to payment transfer success.
* @title ERC-7573 Decryption Contract - Conditional decryption of keys, conditional to transfer success.
* @dev Interface specification for a smart contract that enables secure stateless delivery-versus-payment.
*
* The specification consists of two interface, one
* is implemented by a smart contract on the "asset chain"
* (the asset contract), the other is implemented by
* a smart contract on the "payment chain" (the payment contract).
* The specification consists of two interface,
* one is implemented by a smart contract on one chain (e.g. the "asset chain" - the asset contract), the other is implemented by
* a smart contract on another chain (e.g. the "payment chain" - the payment contract).
* One contract performs a locking, where a transfer is conditional on a presented key: locking contract.
* The other contract performs a condition decryption of keys, conditional to transfer success of failure: decryption contract.
*
* This is the payment contracts interface.
* This is the decryption contracts interface.
*
* The rationale is that the payment in setup with
* two encrypted keys, the encryptedSuccessKey and the encryptedFailureKey.
* Upon payment transfer a conditional decryption of one the encrypted keys
* is performed.
* The rationale is that a transfer in setup with two encrypted keys, the encryptedSuccessKey and the encryptedFailureKey.
* Upon transfer a conditional decryption of one the encrypted keys is performed.
*/
interface IDecryptionContract {

/*------------------------------------------- EVENTS ---------------------------------------------------------------------------------------*/

/**
* @dev Emitted when the transfer for the payment is incepted.
* @param initiator is the address from which payment transfer was incepted
* @dev Emitted when the transfer is incepted.
* @param initiator is the address from which the transfer was incepted
* @param id the trade ID.
* @param amount to be transfered.
*/
Expand All @@ -42,14 +41,14 @@ interface IDecryptionContract {
* @dev Emitted when the decrypted key has been obtained.
* @param id the trade ID.
* @param success a boolean indicating the status. True: success. False: failure.
* @param key the descrypted key.
* @param key the decrypted key.
*/
event TransferKeyReleased(bytes32 id, bool success, string key);

/*------------------------------------------- FUNCTIONALITY ---------------------------------------------------------------------------------------*/

/**
* @notice Called from the payer of the payment to initiate payment transfer.
* @notice Called from the receiver of the amount to initiate payment transfer.
* @dev emits a {PaymentTransferIncepted}
* @param id the trade identifier of the trade.
* @param amount the amount to be transfered.
Expand All @@ -60,7 +59,7 @@ interface IDecryptionContract {
function inceptTransfer(bytes32 id, int amount, address from, string memory keyEncryptedSuccess, string memory keyEncryptedFailure) external;

/**
* @notice Called from the sender of the payment to initiate completion of the payment transfer.
* @notice Called from the sender of the amount to initiate completion of the payment transfer.
* @dev emits a {TransferKeyRequested} and {TransferKeyReleased} with keys depending on completion success.
* @param id the trade identifier of the trade.
* @param from The address of the sender of the payment.
Expand Down
45 changes: 22 additions & 23 deletions solidity/contracts/dvp-impl/interface/ILockingContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,51 @@ pragma solidity >=0.7.0;
/*------------------------------------------- DESCRIPTION ---------------------------------------------------------------------------------------*/

/**
* @title ERC-DVP ASSET Locking of assets and conditional decryption of release keys upon payment to allow secure stateless delivery-versus-payment.
* @title ERC-7573 Locking Contract - Conditional unlocking of tokens, conditional to presentation of key.
* @dev Interface specification for a smart contract that enables secure stateless delivery-versus-payment.
*
* The specification consists of two interface, one
* is implemented by a smart contract on the "asset chain"
* (the asset contract), the other is implemented by
* a smart contract on the "payment chain" (the payment contract).
* The specification consists of two interface,
* one is implemented by a smart contract on one chain (e.g. the "asset chain" - the asset contract), the other is implemented by
* a smart contract on another chain (e.g. the "payment chain" - the payment contract).
* One contract performs a locking, where a transfer is conditional on a presented key: locking contract.
* The other contract performs a condition decryption of keys, conditional to transfer success of failure: decryption contract.
*
* This is the asset contracts interface.
* This is the locking contracts interface.
*
* The rationale is that the asset is locked with with two encrypted keys
* 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).
*
* The asset in transfered to the address of the buyer, if the
* buyer's key is presented.
* The asset in transfered to the address of the buyer, if the buyer's key is presented.
*
* The asset in (re-)transfered to the address of the seller, if the
* seller's key is presented.
* The asset in (re-)transfered to the address of the seller, if the seller's key is presented.
*/
interface ILockingContract {

/*------------------------------------------- EVENTS ---------------------------------------------------------------------------------------*/

/**
* @dev Emitted when the transfer for the asset is incepted
* @dev Emitted when the transfer for the token is incepted
* @param initiator is the address from which trade was incepted
* @param id the trade ID
*/
event TransferIncepted(address initiator, bytes32 id);

/**
* @dev Emitted when the transfer for the asset is incepted
* @dev Emitted when the transfer for the token is incepted
* @param confirmer is the address from which trade was incepted
* @param id the trade ID
*/
event TransferConfirmed(address confirmer, bytes32 id);

/**
* @dev Emitted when a confirmed trade is set to active - e.g. when termination fee amounts are provided
* @dev Emitted when the token was successfully claimed (forward to buyer).
* @param id the trade ID
* @param key the key that was used to claim the asset
*/
event TokenClaimed(bytes32 id, string key);

/**
* @dev Emitted when an active trade is terminated
* @dev Emitted when the token was re-claimed (back to seller).
* @param id the trade ID
* @param key the key that was used to claim the asset
*/
Expand All @@ -58,26 +57,26 @@ interface ILockingContract {
/*------------------------------------------- FUNCTIONALITY ---------------------------------------------------------------------------------------*/

/**
* @notice Called from the buyer of the asset to initiate asset transfer.
* @dev emits a {AssetTransferIncepted}
* @notice Called from the buyer of the token to initiate token transfer.
* @dev emits a {TransferIncepted}
* @param id the trade identifier of the trade.
* @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 asset.
* @param keyEncryptedSeller Encryption 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;

/**
* @notice Called from the seller of the asset to confirm asset transfer. Locks the asset.
* @dev emits a {AssetTransferConfirmed}
* @notice Called from the seller of the token to confirm token transfer. Locks the token.
* @dev emits a {TransferConfirmed}
* @param id the trade identifier of the trade.
* @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 seller to claim the asset.
* @param keyEncryptedBuyer Encryption of the key that can be used by the seller to claim the token.
*/
function confirmTransfer(bytes32 id, int amount, address to, string memory keyEncryptedBuyer) external;

/**
* @notice Called from the buyer or seller to claim or (re-)claim the asset. Unlocks the asset.
* @dev emits a {AssetClaimed} or {AssetReclaimed}
* @notice Called from the buyer or seller to claim or (re-)claim the token. Unlocks the token.
* @dev emits a {TokenClaimed} or {TokenReclaimed}
* @param id the trade identifier of the trade.
* @param key The key for which the hash or encryption matches either keyEncryptedBuyer (for transfer to buyer) or keyEncryptedSeller (for transfer to seller).
*/
Expand Down

0 comments on commit 00a6363

Please sign in to comment.