Migrate ERC165 tests (#4794)

This commit is contained in:
Hadrien Croubois
2023-12-19 02:28:16 +01:00
committed by GitHub
parent c3cd70811b
commit 5bca2119ca
4 changed files with 109 additions and 154 deletions

View File

@ -1,5 +1,14 @@
const { ethers } = require('hardhat');
const selector = signature => ethers.FunctionFragment.from(signature).selector;
const interfaceId = signatures =>
ethers.toBeHex(
signatures.reduce((acc, signature) => acc ^ ethers.toBigInt(selector(signature)), 0n),
4,
);
module.exports = {
selector: signature => ethers.FunctionFragment.from(signature).selector,
selector,
interfaceId,
};