Skip to content

Commit e1c0b3c

Browse files
committed
add ERC165 to mock
1 parent aa82c30 commit e1c0b3c

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

contracts/token/common/ERC2981/ERC2981Mock.sol

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,33 @@
22

33
pragma solidity ^0.8.8;
44

5-
import { ERC2981 } from './ERC2981.sol';
5+
import { ERC2981, IERC2981 } from './ERC2981.sol';
66
import { ERC2981Storage } from './ERC2981Storage.sol';
77

8-
import { ERC165 } from '../../../introspection/ERC165.sol';
8+
import { IERC165, ERC165, ERC165Storage } from '../../../introspection/ERC165.sol';
99

1010
contract ERC2981Mock is ERC2981, ERC165 {
11+
using ERC165Storage for ERC165Storage.Layout;
12+
1113
constructor(
1214
uint16 defaultRoyaltyBPS,
1315
uint16[] memory royaltiesBPS,
1416
address defaultRoyaltyReceiver
1517
) {
16-
ERC2981Storage.Layout storage l = ERC2981Storage.layout();
18+
{
19+
ERC2981Storage.Layout storage l = ERC2981Storage.layout();
20+
l.defaultRoyaltyBPS = defaultRoyaltyBPS;
21+
l.defaultRoyaltyReceiver = defaultRoyaltyReceiver;
1722

18-
l.defaultRoyaltyBPS = defaultRoyaltyBPS;
19-
l.defaultRoyaltyReceiver = defaultRoyaltyReceiver;
23+
for (uint8 i = 0; i < royaltiesBPS.length; i++) {
24+
l.royaltiesBPS[i] = royaltiesBPS[i];
25+
}
26+
}
2027

21-
for (uint8 i = 0; i < royaltiesBPS.length; i++) {
22-
l.royaltiesBPS[i] = royaltiesBPS[i];
28+
{
29+
ERC165Storage.Layout storage l = ERC165Storage.layout();
30+
l.setSupportedInterface(type(IERC165).interfaceId, true);
31+
l.setSupportedInterface(type(IERC2981).interfaceId, true);
2332
}
2433
}
2534

0 commit comments

Comments
 (0)