Hi,
I’m trying to test my upgradeable contract, using the @openzeppelin/truffle-upgrades library.
For that I’ve create a test block, but when I try to use deployProxy, I get this error:
1) Contract: TestCollection
"before all" hook in "Contract: TestCollection":
TypeError: Cannot use 'in' operator to search for 'sendAsync' in undefined
at Object.wrapProvider (node_modules/@openzeppelin/truffle-upgrades/src/utils/wrap-provider.ts:9:33)
at deployProxy (node_modules/@openzeppelin/truffle-upgrades/src/deploy-proxy.ts:34:20)
at Context.<anonymous> (test/TestCollection.js:23:28)
Environment
{
"name": "hardhat-project",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/hardhat-upgrades": "^1.10.0",
"@openzeppelin/truffle-upgrades": "^1.9.1",
"chai": "^4.3.4",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.4.7",
"hardhat": "^2.6.6"
},
"dependencies": {
"@nomiclabs/hardhat-truffle5": "^2.0.2",
"@openzeppelin/contracts-upgradeable": "^4.3.2"
}
}
Code to reproduce
The reproducible code is here
const { artifacts } = require("hardhat");
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
const TestCollection = artifacts.require(
"../artifacts/contracts/TestCollection.sol"
);
contract("TestCollection", (accounts) => {
const URI_BASE = 'https://api.oncurio.com';
const CONTRACT_URI = `${URI_BASE}/collections/test/`;
let testCollection;
const owner = accounts[0];
const firstUser = accounts[1];
const secondUser = accounts[2];
const thirdUser = accounts[3];
const [deployer] = accounts;
before(async () => {
testCollection = await deployProxy(TestCollection, ["TestCollection", "TST", "0xf57b2c51ded3a29e6891aba85459d600256cf317"], { deployer });
});