mirror of
https://github.com/luxfi/eoa-contracts.git
synced 2026-10-30 16:58:32 +00:00
55 lines
2.4 KiB
Solidity
55 lines
2.4 KiB
Solidity
// SPDX-License-Identifier: LGPL-3.0-only
|
|
pragma solidity 0.8.17;
|
|
|
|
/**
|
|
Note: The ERC-165 identifier for this interface is 0x4e2312e0.
|
|
*/
|
|
interface IERC1155TokenReceiver {
|
|
/**
|
|
* @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.
|
|
*
|
|
* NOTE: To accept the transfer, this must return
|
|
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
|
|
* (i.e. 0xf23a6e61, or its own function selector).
|
|
*
|
|
* @param _operator The address which initiated the transfer (i.e. msg.sender)
|
|
* @param _from The address which previously owned the token
|
|
* @param _id The ID of the token being transferred
|
|
* @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(
|
|
address _operator,
|
|
address _from,
|
|
uint256 _id,
|
|
uint256 _value,
|
|
bytes calldata _data
|
|
) external returns (bytes4);
|
|
|
|
/**
|
|
* @dev Handles the receipt of a multiple ERC1155 token types. This function
|
|
* is called at the end of a `safeBatchTransferFrom` after the balances have
|
|
* been updated.
|
|
*
|
|
* NOTE: To accept the transfer(s), this must return
|
|
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
|
|
* (i.e. 0xbc197c81, or its own function selector).
|
|
*
|
|
* @param _operator The address which initiated the batch transfer (i.e. msg.sender)
|
|
* @param _from The address which previously owned the token
|
|
* @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 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 allowed
|
|
*/
|
|
function onERC1155BatchReceived(
|
|
address _operator,
|
|
address _from,
|
|
uint256[] calldata _ids,
|
|
uint256[] calldata _values,
|
|
bytes calldata _data
|
|
) external returns (bytes4);
|
|
}
|