I am currently using @openzeppelin/contracts@^4.9.0 with a Hardhat project (hardhat@^2.14.0) and solc 0.8.18.x. I'm getting a Strings.toString(...) error: Member "toString" not unique after argument-dependent lookup in type(library Strings).
I've tried installing other solc and package versions without success and have no clue why this is all of the sudden happening—IDE tried with both Remix and VS Code.
Here is the code that fails:
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.10 <0.9.0;
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
contract Template {
string private test;
constructor() {
test = string.concat(Strings.toString(1)," Bobby Tables");
}
}
And if, instead, it's statically defined as a variable v, it works as expected:
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.10 <0.9.0;
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
contract Template {
string private test;
constructor() {
uint256 v = 1;
test = string.concat(Strings.toString(v)," Bobby Tables");
}
}
The first example was working in very recent projects that use this dep, but it not longer is working as expected.