I created 2 smart contracts.
contract A is ERC20 token and B is a contract that accepts ERC20 A as payment method. When deploying, contract A got deployed but when I passed its proxy address to the initialize function in contract B for deployment it shows this error: TypeError: Cannot create property 'kind' on string '0x814bd9012bD1e51b86890343b9731501875502e8'
what could be the problem?
hardhat deploy script
const token = await ethers.getContractFactory("Token");
console.log("Deploying token...");
const tokeninit= await upgrades.deployProxy(token , {
initializer: "initialize",
});
await tokeninit.deployed();
const tokenaddr = tokeninit.address;
console.log("token deployed at :", tokenaddr );
const SmartB= await ethers.getContractFactory("SmartB");
const SmartBInit= await upgrades.deployProxy(SmartB,tokenaddr, {
initializer: "initialize",
});
Smart contract B shorten code:
contract SamrtB is Initializable, UUPSUpgradeable, OwnableUpgradeable {
using CountersUpgradeable for CountersUpgradeable.Counter;
CountersUpgradeable.Counter private _tokenIdCounter;
IERC20Upgradeable public tokenAccepted;
constructor() initializer {}
function initialize(address _token) initializer public {
__Ownable_init();
__UUPSUpgradeable_init();
tokenAccepted =IERC20Upgradeable(_token);
}