ERC721LazyMintWith712Signature + Upgradeable

I'm trying to take the ERC721LazyMintWith712Signature.sol code and create an upgradeable version of it, and add some other functionality as well. So far I'm able to compile the code, but the minting and transferring tests fail with an exception I can't seem to crack:

Error: resolver or addr is not configured for ENS name (argument="name", value="6705805767844207723261592881831509603729469983418291212309451818559986173218", code=INVALID_ARGUMENT, version=contracts/5.4.1)

This occurs in this portion of the test:

        await expect(this.registry.connect(this.accounts[2]).redeem(account, tokenId, this.smartwallet.address, signature))
          .to.emit(this.registry, 'Transfer')
          .withArgs(ethers.constants.AddressZero, account, tokenId);

:1234: Code to reproduce

I've pushed a repo that shows the error with the three commands below.
The repo can be found here: https://github.com/Mjavala/Rays

-   npm i
-   npx hardhat compile
-   npx hardhat test  

:computer: Environment

I'm using the following env:
hardhat - 2.5.0
node - v14.15.4
sol - 0.8.4

** this is my first topic, if I've messed up the format or provided insufficient information, please let me know!

This error means that an address was expected somewhere and you passed a non-address value. According to the error, this happened in an argument called name. I can't tell what argument this is because I don't know the argument names but you should be able to check based on this information.

Hey frangio, thanks for the reply. It turned out that i had mixed up the order of variables in this redeem function:

    function redeem(address account, address signer, uint256 tokenId, bytes calldata signature)
    external
    {
        require(_verify(signer, _hash(account, tokenId), signature), "Invalid signature");
        _safeMint(account, tokenId);
    }

However now I'm getting this error:

 Error: VM Exception while processing transaction: reverted with reason string 'Invalid signature'
      at Rays.redeem (contracts/Rays.sol:41)
      at <UnrecognizedContract>.<unknown> (0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at runNextTicks (internal/process/task_queues.js:62:3)
      at listOnTimeout (internal/timers.js:523:9)
      at processTimers (internal/timers.js:497:7)
      at HardhatNode._mineBlockWithPendingTxs (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1575:23)
      at HardhatNode.mineBlock (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:443:16)
      at EthModule._sendTransactionAndReturnHash (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1500:18)

When running the following code:

        await expect(this.registry.connect(this.accounts[2]).redeem(account, this.smartwallet.address, tokenId, signature))
          .to.emit(this.registry, 'Transfer')
          .withArgs(ethers.constants.AddressZero, account, tokenId);

I'm pretty sure it has something to do with the proxy, since this code works for the base contract.

I've updated the repo with this latest error, any ideas?

Debugging invalid signatures is difficult and from a quick glance I can't see what could be wrong. I suggest slowly trying to build up from a simple traditional signature to an EIP712 signature to try to find out what's wrong.

1 Like