-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
IERC1155Receiver.sol
33 lines (30 loc) · 1 KB
/
IERC1155Receiver.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../34_ERC721/IERC165.sol";
/**
* @dev ERC1155接收合约,要接受ERC1155的安全转账,需要实现这个合约
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev 接受ERC1155安全转账`safeTransferFrom`
* 需要返回 0xf23a6e61 或 `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev 接受ERC1155批量安全转账`safeBatchTransferFrom`
* 需要返回 0xbc197c81 或 `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}