diff --git a/README.md b/README.md index b75b7b2..7388d2b 100644 --- a/README.md +++ b/README.md @@ -127,12 +127,12 @@ Same as `inLogs`, but for events emitted in an arbitrary transaction (of hash `t --- -### makeInterfaceId (interfaces = []) -#### ERC165 +### makeInterfaceId +#### ERC165 (interfaces = []) Calculates the [ERC165](https://eips.ethereum.org/EIPS/eip-165) interface ID of a contract, given a series of function signatures. -#### ERC1820 -Calculates the [ERC1820](https://eips.ethereum.org/EIPS/eip-1820) interface hash of a function, given its signature. +#### ERC1820 (name) +Calculates the [ERC1820](https://eips.ethereum.org/EIPS/eip-1820) interface hash of a contract, given its name. --- diff --git a/src/makeInterfaceId.js b/src/makeInterfaceId.js index 29fc1ac..7f82638 100644 --- a/src/makeInterfaceId.js +++ b/src/makeInterfaceId.js @@ -18,8 +18,8 @@ function ERC165 (functionSignatures = []) { return `0x${interfaceIdBuffer.toString('hex')}`; } -function ERC1820 (functionSignature) { - return web3.utils.soliditySha3(functionSignature); // keccak256 +function ERC1820 (interfaceName) { + return web3.utils.soliditySha3(interfaceName); // keccak256 } module.exports = { diff --git a/test/src/makeInterfaceId.test.js b/test/src/makeInterfaceId.test.js index f2c3c91..c29fdb6 100644 --- a/test/src/makeInterfaceId.test.js +++ b/test/src/makeInterfaceId.test.js @@ -19,8 +19,8 @@ describe('makeInterfaceId', function () { }); }); - describe('ERC165', function () { - it('calculates the interface id from function signatures', async function () { + describe('ERC1820', function () { + it('calculates the interface hash a from a contract name', async function () { expect(makeInterfaceId.ERC1820('ERC777Token')).to.equal( '0xac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce2177054' );