hypercerts-org / hypercerts

Hypercerts are a tool to build scalable retrospective reward systems for impact.
https://hypercerts.org/
Other
91 stars 28 forks source link

Error (7576): Undeclared identifier. SemiFungible1155.sol:268:13: #1307

Closed positonic closed 4 months ago

positonic commented 4 months ago

Which area(s) of Hypercerts are affected? (leave empty if unsure)

Smart Contracts

To Reproduce

I am importing HypercertMinter.sol into my Foundry project

import {HypercertMinter} from "hypercerts-contracts/HypercertMinter.sol";

and running tests

Describe the Bug

When I try to run my tests I get this error:

Error: 
Compiler run failed:
Error (7576): Undeclared identifier.
   --> /Users/james/code/hyperstaker-mono/lib/hypercerts/contracts/contracts/SemiFungible1155.sol:268:13:
    |
268 |         if (_to == address(0) || owners[target] != _account) revert Errors.NotAllowed();
    |             ^^^

The error is happening in the function _mergeTokensUnits function.

I believe this line of code is redundant and can be removed.

Expected Behavior

All variables should be declared and there shouldn't be an error

bitbeckers commented 4 months ago

It looks like you're trying to directly import as a foundry lib but importing from the wrong path.

hypercerts/contracts/src/protocol/ is the folder containing the source code.

You can see the _mergeTokenUnits is consistent here: https://github.com/hypercerts-org/hypercerts/blob/7671d06762c929bc2890a31e5dc392f8a30065c6/contracts/src/protocol/SemiFungible1155.sol#L370

positonic commented 4 months ago

It's working with the contracts in hypercerts/contracts/src/protocol/ Thanks!