Improve ERC1363 documentation (#3993)
Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
committed by
GitHub
parent
8b47e96af1
commit
3f3774c5df
@ -6,6 +6,13 @@ pragma solidity ^0.8.0;
|
|||||||
import "./IERC20.sol";
|
import "./IERC20.sol";
|
||||||
import "./IERC165.sol";
|
import "./IERC165.sol";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Interface of an ERC1363 compliant contract, as defined in the
|
||||||
|
* https://eips.ethereum.org/EIPS/eip-1363[EIP].
|
||||||
|
*
|
||||||
|
* Defines a interface for ERC20 tokens that supports executing recipient
|
||||||
|
* code after `transfer` or `transferFrom`, or spender code after `approve`.
|
||||||
|
*/
|
||||||
interface IERC1363 is IERC165, IERC20 {
|
interface IERC1363 is IERC165, IERC20 {
|
||||||
/*
|
/*
|
||||||
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
|
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
|
||||||
@ -21,53 +28,53 @@ interface IERC1363 is IERC165, IERC20 {
|
|||||||
/**
|
/**
|
||||||
* @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
|
* @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
|
||||||
* @param to address The address which you want to transfer to
|
* @param to address The address which you want to transfer to
|
||||||
* @param value uint256 The amount of tokens to be transferred
|
* @param amount uint256 The amount of tokens to be transferred
|
||||||
* @return true unless throwing
|
* @return true unless throwing
|
||||||
*/
|
*/
|
||||||
function transferAndCall(address to, uint256 value) external returns (bool);
|
function transferAndCall(address to, uint256 amount) external returns (bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
|
* @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
|
||||||
* @param to address The address which you want to transfer to
|
* @param to address The address which you want to transfer to
|
||||||
* @param value uint256 The amount of tokens to be transferred
|
* @param amount uint256 The amount of tokens to be transferred
|
||||||
* @param data bytes Additional data with no specified format, sent in call to `to`
|
* @param data bytes Additional data with no specified format, sent in call to `to`
|
||||||
* @return true unless throwing
|
* @return true unless throwing
|
||||||
*/
|
*/
|
||||||
function transferAndCall(address to, uint256 value, bytes memory data) external returns (bool);
|
function transferAndCall(address to, uint256 amount, bytes memory data) external returns (bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
|
* @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
|
||||||
* @param from address The address which you want to send tokens from
|
* @param from address The address which you want to send tokens from
|
||||||
* @param to address The address which you want to transfer to
|
* @param to address The address which you want to transfer to
|
||||||
* @param value uint256 The amount of tokens to be transferred
|
* @param amount uint256 The amount of tokens to be transferred
|
||||||
* @return true unless throwing
|
* @return true unless throwing
|
||||||
*/
|
*/
|
||||||
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
|
function transferFromAndCall(address from, address to, uint256 amount) external returns (bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
|
* @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
|
||||||
* @param from address The address which you want to send tokens from
|
* @param from address The address which you want to send tokens from
|
||||||
* @param to address The address which you want to transfer to
|
* @param to address The address which you want to transfer to
|
||||||
* @param value uint256 The amount of tokens to be transferred
|
* @param amount uint256 The amount of tokens to be transferred
|
||||||
* @param data bytes Additional data with no specified format, sent in call to `to`
|
* @param data bytes Additional data with no specified format, sent in call to `to`
|
||||||
* @return true unless throwing
|
* @return true unless throwing
|
||||||
*/
|
*/
|
||||||
function transferFromAndCall(address from, address to, uint256 value, bytes memory data) external returns (bool);
|
function transferFromAndCall(address from, address to, uint256 amount, bytes memory data) external returns (bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
|
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
|
||||||
* and then call `onApprovalReceived` on spender.
|
* and then call `onApprovalReceived` on spender.
|
||||||
* @param spender address The address which will spend the funds
|
* @param spender address The address which will spend the funds
|
||||||
* @param value uint256 The amount of tokens to be spent
|
* @param amount uint256 The amount of tokens to be spent
|
||||||
*/
|
*/
|
||||||
function approveAndCall(address spender, uint256 value) external returns (bool);
|
function approveAndCall(address spender, uint256 amount) external returns (bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
|
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
|
||||||
* and then call `onApprovalReceived` on spender.
|
* and then call `onApprovalReceived` on spender.
|
||||||
* @param spender address The address which will spend the funds
|
* @param spender address The address which will spend the funds
|
||||||
* @param value uint256 The amount of tokens to be spent
|
* @param amount uint256 The amount of tokens to be spent
|
||||||
* @param data bytes Additional data with no specified format, sent in call to `spender`
|
* @param data bytes Additional data with no specified format, sent in call to `spender`
|
||||||
*/
|
*/
|
||||||
function approveAndCall(address spender, uint256 value, bytes memory data) external returns (bool);
|
function approveAndCall(address spender, uint256 amount, bytes memory data) external returns (bool);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
pragma solidity ^0.8.0;
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Interface for any contract that wants to support {IERC1363-transferAndCall}
|
||||||
|
* or {IERC1363-transferFromAndCall} from {ERC1363} token contracts.
|
||||||
|
*/
|
||||||
interface IERC1363Receiver {
|
interface IERC1363Receiver {
|
||||||
/*
|
/*
|
||||||
* Note: the ERC-165 identifier for this interface is 0x88a7ca5c.
|
* Note: the ERC-165 identifier for this interface is 0x88a7ca5c.
|
||||||
@ -18,15 +22,14 @@ interface IERC1363Receiver {
|
|||||||
* Note: the token contract address is always the message sender.
|
* Note: the token contract address is always the message sender.
|
||||||
* @param operator address The address which called `transferAndCall` or `transferFromAndCall` function
|
* @param operator address The address which called `transferAndCall` or `transferFromAndCall` function
|
||||||
* @param from address The address which are token transferred from
|
* @param from address The address which are token transferred from
|
||||||
* @param value uint256 The amount of tokens transferred
|
* @param amount uint256 The amount of tokens transferred
|
||||||
* @param data bytes Additional data with no specified format
|
* @param data bytes Additional data with no specified format
|
||||||
* @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))`
|
* @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` unless throwing
|
||||||
* unless throwing
|
|
||||||
*/
|
*/
|
||||||
function onTransferReceived(
|
function onTransferReceived(
|
||||||
address operator,
|
address operator,
|
||||||
address from,
|
address from,
|
||||||
uint256 value,
|
uint256 amount,
|
||||||
bytes memory data
|
bytes memory data
|
||||||
) external returns (bytes4);
|
) external returns (bytes4);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
pragma solidity ^0.8.0;
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Interface for any contract that wants to support {IERC1363-approveAndCall}
|
||||||
|
* from {ERC1363} token contracts.
|
||||||
|
*/
|
||||||
interface IERC1363Spender {
|
interface IERC1363Spender {
|
||||||
/*
|
/*
|
||||||
* Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
|
* Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
|
||||||
@ -17,10 +21,9 @@ interface IERC1363Spender {
|
|||||||
* transaction being reverted.
|
* transaction being reverted.
|
||||||
* Note: the token contract address is always the message sender.
|
* Note: the token contract address is always the message sender.
|
||||||
* @param owner address The address which called `approveAndCall` function
|
* @param owner address The address which called `approveAndCall` function
|
||||||
* @param value uint256 The amount of tokens to be spent
|
* @param amount uint256 The amount of tokens to be spent
|
||||||
* @param data bytes Additional data with no specified format
|
* @param data bytes Additional data with no specified format
|
||||||
* @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`
|
* @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`unless throwing
|
||||||
* unless throwing
|
|
||||||
*/
|
*/
|
||||||
function onApprovalReceived(address owner, uint256 value, bytes memory data) external returns (bytes4);
|
function onApprovalReceived(address owner, uint256 amount, bytes memory data) external returns (bytes4);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user