From fae9d1ed04e46074a4e64c3e9744140a37484f9a Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Wed, 24 Jan 2024 10:33:53 +0100 Subject: [PATCH 1/3] improve erc1363 doc --- contracts/token/ERC20/extensions/ERC1363.sol | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/token/ERC20/extensions/ERC1363.sol b/contracts/token/ERC20/extensions/ERC1363.sol index 1d9bbddcd11..c4a8e340305 100644 --- a/contracts/token/ERC20/extensions/ERC1363.sol +++ b/contracts/token/ERC20/extensions/ERC1363.sol @@ -57,8 +57,8 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement the {IERC1363Receiver} interface. - * - The target should return the {IERC1363Receiver} interface id. + * - The target `to` must implement {IERC1363Receiver-onTransferReceived}. + * - The target must return the {IERC1363Receiver-onTransferReceived} selector to accept the transfer. * - The internal {transfer} must succeed (returned `true`). */ function transferAndCall(address to, uint256 value) public returns (bool) { @@ -84,8 +84,8 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement the {IERC1363Receiver} interface. - * - The target should return the {IERC1363Receiver} interface id. + * - The target `to` must implement {IERC1363Receiver-onTransferReceived}. + * - The target must return the {IERC1363Receiver-onTransferReceived} selector to accept the transfer. * - The internal {transferFrom} must succeed (returned `true`). */ function transferFromAndCall(address from, address to, uint256 value) public returns (bool) { @@ -116,8 +116,8 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement the {IERC1363Spender} interface. - * - The target should return the {IERC1363Spender} interface id. + * - The target `to` must implement {IERC1363Spender-onApprovalReceived}. + * - The target must return the {IERC1363Spender-onApprovalReceived} selector to accept the approval. * - The internal {approve} must succeed (returned `true`). */ function approveAndCall(address spender, uint256 value) public returns (bool) { From c80f447f9ac618f2222f13e4ea196750fd218fe8 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Wed, 24 Jan 2024 10:42:44 +0100 Subject: [PATCH 2/3] up --- contracts/token/ERC20/extensions/ERC1363.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/token/ERC20/extensions/ERC1363.sol b/contracts/token/ERC20/extensions/ERC1363.sol index c4a8e340305..133420be5c1 100644 --- a/contracts/token/ERC20/extensions/ERC1363.sol +++ b/contracts/token/ERC20/extensions/ERC1363.sol @@ -57,7 +57,7 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement {IERC1363Receiver-onTransferReceived}. + * - The target `to` must implement the {IERC1363Receiver} interface. * - The target must return the {IERC1363Receiver-onTransferReceived} selector to accept the transfer. * - The internal {transfer} must succeed (returned `true`). */ @@ -84,7 +84,7 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement {IERC1363Receiver-onTransferReceived}. + * - The target `to` must implement the {IERC1363Receiver} interface. * - The target must return the {IERC1363Receiver-onTransferReceived} selector to accept the transfer. * - The internal {transferFrom} must succeed (returned `true`). */ @@ -116,7 +116,7 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement {IERC1363Spender-onApprovalReceived}. + * - The target `to` must implement the {IERC1363Spender} interface. * - The target must return the {IERC1363Spender-onApprovalReceived} selector to accept the approval. * - The internal {approve} must succeed (returned `true`). */ @@ -143,7 +143,7 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * * - The target has code (i.e. is a contract). * - The target `to` must implement the {IERC1363Receiver} interface. - * - The target should return the {IERC1363Receiver} interface id. + * - The target must return the {IERC1363Receiver-onTransferReceived} selector to accept the transfer. */ function _checkOnTransferReceived(address from, address to, uint256 value, bytes memory data) private { if (to.code.length == 0) { @@ -173,7 +173,7 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * * - The target has code (i.e. is a contract). * - The target `to` must implement the {IERC1363Spender} interface. - * - The target should return the {IERC1363Spender} interface id. + * - The target must return the {IERC1363Spender-onApprovalReceived} selector to accept the approval. */ function _checkOnApprovalReceived(address spender, uint256 value, bytes memory data) private { if (spender.code.length == 0) { From e84333fb372c671d17d6c0fd93a691ee14dbada5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20Garc=C3=ADa?= Date: Wed, 24 Jan 2024 08:58:21 -0600 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Vittorio Minacori --- contracts/token/ERC20/extensions/ERC1363.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/token/ERC20/extensions/ERC1363.sol b/contracts/token/ERC20/extensions/ERC1363.sol index 133420be5c1..20cb6d9dd90 100644 --- a/contracts/token/ERC20/extensions/ERC1363.sol +++ b/contracts/token/ERC20/extensions/ERC1363.sol @@ -116,7 +116,7 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement the {IERC1363Spender} interface. + * - The target `spender` must implement the {IERC1363Spender} interface. * - The target must return the {IERC1363Spender-onApprovalReceived} selector to accept the approval. * - The internal {approve} must succeed (returned `true`). */ @@ -172,7 +172,7 @@ abstract contract ERC1363 is ERC20, ERC165, IERC1363 { * Requirements: * * - The target has code (i.e. is a contract). - * - The target `to` must implement the {IERC1363Spender} interface. + * - The target `spender` must implement the {IERC1363Spender} interface. * - The target must return the {IERC1363Spender-onApprovalReceived} selector to accept the approval. */ function _checkOnApprovalReceived(address spender, uint256 value, bytes memory data) private {