Skip to content

Commit 3f3774c

Browse files
Improve ERC1363 documentation (#3993)
Co-authored-by: Francisco <fg@frang.io>
1 parent 8b47e96 commit 3f3774c

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

contracts/interfaces/IERC1363.sol

+19-12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ pragma solidity ^0.8.0;
66
import "./IERC20.sol";
77
import "./IERC165.sol";
88

9+
/**
10+
* @dev Interface of an ERC1363 compliant contract, as defined in the
11+
* https://eips.ethereum.org/EIPS/eip-1363[EIP].
12+
*
13+
* Defines a interface for ERC20 tokens that supports executing recipient
14+
* code after `transfer` or `transferFrom`, or spender code after `approve`.
15+
*/
916
interface IERC1363 is IERC165, IERC20 {
1017
/*
1118
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
@@ -21,53 +28,53 @@ interface IERC1363 is IERC165, IERC20 {
2128
/**
2229
* @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
2330
* @param to address The address which you want to transfer to
24-
* @param value uint256 The amount of tokens to be transferred
31+
* @param amount uint256 The amount of tokens to be transferred
2532
* @return true unless throwing
2633
*/
27-
function transferAndCall(address to, uint256 value) external returns (bool);
34+
function transferAndCall(address to, uint256 amount) external returns (bool);
2835

2936
/**
3037
* @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
3138
* @param to address The address which you want to transfer to
32-
* @param value uint256 The amount of tokens to be transferred
39+
* @param amount uint256 The amount of tokens to be transferred
3340
* @param data bytes Additional data with no specified format, sent in call to `to`
3441
* @return true unless throwing
3542
*/
36-
function transferAndCall(address to, uint256 value, bytes memory data) external returns (bool);
43+
function transferAndCall(address to, uint256 amount, bytes memory data) external returns (bool);
3744

3845
/**
3946
* @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
4047
* @param from address The address which you want to send tokens from
4148
* @param to address The address which you want to transfer to
42-
* @param value uint256 The amount of tokens to be transferred
49+
* @param amount uint256 The amount of tokens to be transferred
4350
* @return true unless throwing
4451
*/
45-
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
52+
function transferFromAndCall(address from, address to, uint256 amount) external returns (bool);
4653

4754
/**
4855
* @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
4956
* @param from address The address which you want to send tokens from
5057
* @param to address The address which you want to transfer to
51-
* @param value uint256 The amount of tokens to be transferred
58+
* @param amount uint256 The amount of tokens to be transferred
5259
* @param data bytes Additional data with no specified format, sent in call to `to`
5360
* @return true unless throwing
5461
*/
55-
function transferFromAndCall(address from, address to, uint256 value, bytes memory data) external returns (bool);
62+
function transferFromAndCall(address from, address to, uint256 amount, bytes memory data) external returns (bool);
5663

5764
/**
5865
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
5966
* and then call `onApprovalReceived` on spender.
6067
* @param spender address The address which will spend the funds
61-
* @param value uint256 The amount of tokens to be spent
68+
* @param amount uint256 The amount of tokens to be spent
6269
*/
63-
function approveAndCall(address spender, uint256 value) external returns (bool);
70+
function approveAndCall(address spender, uint256 amount) external returns (bool);
6471

6572
/**
6673
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
6774
* and then call `onApprovalReceived` on spender.
6875
* @param spender address The address which will spend the funds
69-
* @param value uint256 The amount of tokens to be spent
76+
* @param amount uint256 The amount of tokens to be spent
7077
* @param data bytes Additional data with no specified format, sent in call to `spender`
7178
*/
72-
function approveAndCall(address spender, uint256 value, bytes memory data) external returns (bool);
79+
function approveAndCall(address spender, uint256 amount, bytes memory data) external returns (bool);
7380
}

contracts/interfaces/IERC1363Receiver.sol

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
pragma solidity ^0.8.0;
55

6+
/**
7+
* @dev Interface for any contract that wants to support {IERC1363-transferAndCall}
8+
* or {IERC1363-transferFromAndCall} from {ERC1363} token contracts.
9+
*/
610
interface IERC1363Receiver {
711
/*
812
* Note: the ERC-165 identifier for this interface is 0x88a7ca5c.
@@ -18,15 +22,14 @@ interface IERC1363Receiver {
1822
* Note: the token contract address is always the message sender.
1923
* @param operator address The address which called `transferAndCall` or `transferFromAndCall` function
2024
* @param from address The address which are token transferred from
21-
* @param value uint256 The amount of tokens transferred
25+
* @param amount uint256 The amount of tokens transferred
2226
* @param data bytes Additional data with no specified format
23-
* @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))`
24-
* unless throwing
27+
* @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` unless throwing
2528
*/
2629
function onTransferReceived(
2730
address operator,
2831
address from,
29-
uint256 value,
32+
uint256 amount,
3033
bytes memory data
3134
) external returns (bytes4);
3235
}

contracts/interfaces/IERC1363Spender.sol

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
pragma solidity ^0.8.0;
55

6+
/**
7+
* @dev Interface for any contract that wants to support {IERC1363-approveAndCall}
8+
* from {ERC1363} token contracts.
9+
*/
610
interface IERC1363Spender {
711
/*
812
* Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
@@ -17,10 +21,9 @@ interface IERC1363Spender {
1721
* transaction being reverted.
1822
* Note: the token contract address is always the message sender.
1923
* @param owner address The address which called `approveAndCall` function
20-
* @param value uint256 The amount of tokens to be spent
24+
* @param amount uint256 The amount of tokens to be spent
2125
* @param data bytes Additional data with no specified format
22-
* @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`
23-
* unless throwing
26+
* @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`unless throwing
2427
*/
25-
function onApprovalReceived(address owner, uint256 value, bytes memory data) external returns (bytes4);
28+
function onApprovalReceived(address owner, uint256 amount, bytes memory data) external returns (bytes4);
2629
}

0 commit comments

Comments
 (0)