Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
68e37594
Commit
68e37594
authored
Nov 03, 2021
by
github-actions
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transpile
9b981872
parent
955f5490
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
22 deletions
+34
-22
IERC1155ReceiverUpgradeable.sol
contracts/token/ERC1155/IERC1155ReceiverUpgradeable.sol
+27
-22
README.adoc
contracts/token/ERC1155/README.adoc
+2
-0
ERC1155HolderUpgradeable.sol
contracts/token/ERC1155/utils/ERC1155HolderUpgradeable.sol
+5
-0
No files found.
contracts/token/ERC1155/IERC1155ReceiverUpgradeable.sol
View file @
68e37594
...
@@ -10,17 +10,19 @@ import "../../utils/introspection/IERC165Upgradeable.sol";
...
@@ -10,17 +10,19 @@ import "../../utils/introspection/IERC165Upgradeable.sol";
*/
*/
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
/**
/**
@dev Handles the receipt of a single ERC1155 token type. This function is
* @dev Handles the receipt of a single ERC1155 token type. This function is
called at the end of a `safeTransferFrom` after the balance has been updated.
* called at the end of a `safeTransferFrom` after the balance has been updated.
To accept the transfer, this must return
*
`bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* NOTE: To accept the transfer, this must return
(i.e. 0xf23a6e61, or its own function selector).
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
@param operator The address which initiated the transfer (i.e. msg.sender)
* (i.e. 0xf23a6e61, or its own function selector).
@param from The address which previously owned the token
*
@param id The ID of the token being transferred
* @param operator The address which initiated the transfer (i.e. msg.sender)
@param value The amount of tokens being transferred
* @param from The address which previously owned the token
@param data Additional data with no specified format
* @param id The ID of the token being transferred
@return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
*/
function onERC1155Received(
function onERC1155Received(
address operator,
address operator,
...
@@ -31,17 +33,20 @@ interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
...
@@ -31,17 +33,20 @@ interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
) external returns (bytes4);
) external returns (bytes4);
/**
/**
@dev Handles the receipt of a multiple ERC1155 token types. This function
* @dev Handles the receipt of a multiple ERC1155 token types. This function
is called at the end of a `safeBatchTransferFrom` after the balances have
* is called at the end of a `safeBatchTransferFrom` after the balances have
been updated. To accept the transfer(s), this must return
* been updated.
`bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
*
(i.e. 0xbc197c81, or its own function selector).
* NOTE: To accept the transfer(s), this must return
@param operator The address which initiated the batch transfer (i.e. msg.sender)
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
@param from The address which previously owned the token
* (i.e. 0xbc197c81, or its own function selector).
@param ids An array containing ids of each token being transferred (order and length must match values array)
*
@param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
@param data Additional data with no specified format
* @param from The address which previously owned the token
@return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
*/
function onERC1155BatchReceived(
function onERC1155BatchReceived(
address operator,
address operator,
...
...
contracts/token/ERC1155/README.adoc
View file @
68e37594
...
@@ -26,6 +26,8 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
...
@@ -26,6 +26,8 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
{{IERC1155Receiver}}
{{IERC1155Receiver}}
{{ERC1155Receiver}}
== Extensions
== Extensions
{{ERC1155Pausable}}
{{ERC1155Pausable}}
...
...
contracts/token/ERC1155/utils/ERC1155HolderUpgradeable.sol
View file @
68e37594
...
@@ -7,6 +7,11 @@ import "./ERC1155ReceiverUpgradeable.sol";
...
@@ -7,6 +7,11 @@ import "./ERC1155ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
/**
* Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*
* @dev _Available since v3.1._
* @dev _Available since v3.1._
*/
*/
contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable {
contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment