2
2
pragma solidity ^ 0.8.19 ;
3
3
4
4
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol " ;
5
- import { INSUnified } from "../interfaces/INSUnified.sol " ;
6
5
import { ErrorHandler } from "../libraries/ErrorHandler.sol " ;
6
+ import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol " ;
7
+ import { IERC721Receiver } from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol " ;
8
+ import { IERC1155Receiver } from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol " ;
7
9
8
- contract OwnedMulticaller is Ownable {
10
+ contract OwnedMulticaller is Ownable , IERC721Receiver , IERC1155Receiver {
9
11
using ErrorHandler for bool ;
10
12
11
13
constructor (address owner_ ) {
12
14
require (owner_ != address (0 ), "OwnedMulticaller: owner_ is null " );
15
+
13
16
_transferOwnership (owner_);
14
17
}
15
18
19
+ /**
20
+ * @dev Execute multiple calls in a single transaction.
21
+ * @param tos The addresses to call.
22
+ * @param callDatas The call data for each call.
23
+ * @param values The value to send for each call.
24
+ * @return results The results of each call.
25
+ * @return returnDatas The return data of each call.
26
+ */
16
27
function multicall (address [] calldata tos , bytes [] calldata callDatas , uint256 [] calldata values )
17
28
external
18
29
payable
@@ -29,4 +40,37 @@ contract OwnedMulticaller is Ownable {
29
40
results[i].handleRevert (returnDatas[i]);
30
41
}
31
42
}
43
+
44
+ /**
45
+ * @dev See {IERC165-supportsInterface}.
46
+ */
47
+ function supportsInterface (bytes4 interfaceId ) external view returns (bool ) {
48
+ return interfaceId == type (IERC165 ).interfaceId || interfaceId == type (IERC721Receiver ).interfaceId
49
+ || interfaceId == type (IERC1155Receiver ).interfaceId;
50
+ }
51
+
52
+ /**
53
+ * @dev See {IERC721Receiver-onERC721Received}.
54
+ */
55
+ function onERC721Received (address , address , uint256 , bytes calldata ) external pure returns (bytes4 ) {
56
+ return msg .sig ;
57
+ }
58
+
59
+ /**
60
+ * @dev See {IERC1155Receiver-onERC1155Received}.
61
+ */
62
+ function onERC1155BatchReceived (address , address , uint256 [] calldata , uint256 [] calldata , bytes calldata )
63
+ external
64
+ pure
65
+ returns (bytes4 )
66
+ {
67
+ return msg .sig ;
68
+ }
69
+
70
+ /**
71
+ * @dev See {IERC1155Receiver-onERC1155Received}.
72
+ */
73
+ function onERC1155Received (address , address , uint256 , uint256 , bytes calldata ) external pure returns (bytes4 ) {
74
+ return msg .sig ;
75
+ }
32
76
}
0 commit comments