Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add erc2477 interface. #717

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,247 changes: 654 additions & 593 deletions common/config/rush/npm-shrinkwrap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-ethereum-asset-ledger.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-ethereum-gateway.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-ethereum-http-provider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-ethereum-metamask-provider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-ethereum-value-ledger.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-ethereum.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-wanchain-asset-ledger.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-wanchain-gateway.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-wanchain-http-provider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-wanchain-value-ledger.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/0xcert-wanchain.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.6;
/**
* @title ERC-2477 Non-Fungible Token Metadata Integrity Standard
* @dev See https://eips.ethereum.org/EIPS/eip-2477
* @dev The ERC-165 identifier for this interface is 0x#######. //TODO: FIX THIS
* @dev The ERC-165 identifier for this interface is 0x832a7e0e
*/
interface ERC2477 /* is ERC165 */ {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

pragma solidity 0.8.6;

import "../ierc-2477.sol";
import "../ixcert.sol";
import "../ixcert-burnable.sol";
import "../ixcert-mutable.sol";
Expand All @@ -16,6 +17,18 @@ import "../ixcert-revokable.sol";
contract Selector
{

/**
* @dev Calculates and returns interface ID for the erc2477 smart contract.
*/
function calculateERC2477Selector()
external
pure
returns (bytes4)
{
ERC2477 i;
return (i.tokenURIIntegrity.selector ^ i.tokenURISchemaIntegrity.selector);
MoMannn marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @dev Calculates and returns interface ID for the Xcert smart contract.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ contract XcertToken is
constructor()
{
supportedInterfaces[0x39541724] = true; // Xcert
supportedInterfaces[0x832a7e0e] = true; // ERC2477
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ spec.beforeEach(async (ctx) => {
ctx.set('selector', selector);
});

spec.test('checks erc2477 selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
src: './build/xcert-mock.json',
contract: 'XcertMock',
args: ['Foo', 'F', 'https://0xcert.org/', '.json', '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', []],
});

const bytes = await selector.instance.methods.calculateERC2477Selector().call();
const supports = await xcert.instance.methods.supportsInterface(bytes).call();
ctx.is(supports, true);
});

spec.test('checks Xcert selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
Expand Down