Test ERC165 support in ERC1155Holder (#2365)
This commit is contained in:
committed by
GitHub
parent
e98b187e64
commit
d1c121b599
@ -35,6 +35,10 @@ const INTERFACES = {
|
|||||||
'safeTransferFrom(address,address,uint256,uint256,bytes)',
|
'safeTransferFrom(address,address,uint256,uint256,bytes)',
|
||||||
'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)',
|
'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)',
|
||||||
],
|
],
|
||||||
|
ERC1155Receiver: [
|
||||||
|
'onERC1155Received(address,address,uint256,uint256,bytes)',
|
||||||
|
'onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)',
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const INTERFACE_IDS = {};
|
const INTERFACE_IDS = {};
|
||||||
@ -50,7 +54,7 @@ for (const k of Object.getOwnPropertyNames(INTERFACES)) {
|
|||||||
function shouldSupportInterfaces (interfaces = []) {
|
function shouldSupportInterfaces (interfaces = []) {
|
||||||
describe('Contract interface', function () {
|
describe('Contract interface', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.contractUnderTest = this.mock || this.token;
|
this.contractUnderTest = this.mock || this.token || this.holder;
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const k of interfaces) {
|
for (const k of interfaces) {
|
||||||
|
|||||||
@ -6,6 +6,8 @@ const ERC1155Mock = contract.fromArtifact('ERC1155Mock');
|
|||||||
|
|
||||||
const { expect } = require('chai');
|
const { expect } = require('chai');
|
||||||
|
|
||||||
|
const { shouldSupportInterfaces } = require('../../introspection/SupportsInterface.behavior');
|
||||||
|
|
||||||
describe('ERC1155Holder', function () {
|
describe('ERC1155Holder', function () {
|
||||||
const [creator] = accounts;
|
const [creator] = accounts;
|
||||||
const uri = 'https://token-cdn-domain/{id}.json';
|
const uri = 'https://token-cdn-domain/{id}.json';
|
||||||
@ -19,6 +21,8 @@ describe('ERC1155Holder', function () {
|
|||||||
await this.multiToken.mintBatch(creator, multiTokenIds, multiTokenAmounts, '0x', { from: creator });
|
await this.multiToken.mintBatch(creator, multiTokenIds, multiTokenAmounts, '0x', { from: creator });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
shouldSupportInterfaces(['ERC165', 'ERC1155Receiver']);
|
||||||
|
|
||||||
it('receives ERC1155 tokens from a single ID', async function () {
|
it('receives ERC1155 tokens from a single ID', async function () {
|
||||||
await this.multiToken.safeTransferFrom(
|
await this.multiToken.safeTransferFrom(
|
||||||
creator,
|
creator,
|
||||||
|
|||||||
Reference in New Issue
Block a user