I'm writing a Hardhat test for my contract.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Nft is Initializable, ERC721Upgradeable, OwnableUpgradeable, UUPSUpgradeable , PausableUpgradeable{
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
address public admin;
struct NftItem {
uint256 id;
address creator;
string uri;
bool isMarket;
}
mapping(uint256 => NftItem) public NftItems;
struct UserSell {
uint256 nftCount;
uint256 sellAmount;
}
mapping(address => UserSell) public UserSells;
mapping(address => uint256) public UserNftCount;
struct MarketItem {
uint256 tokenId;
address payable creator;
address payable owner;
uint256 price;
uint256 startDate;
uint256 endDate;
bool ForSale;
bool transfertoAdmin;
}
mapping(uint256 => MarketItem) public MarketItems;
Counters.Counter private SellNftCount;
struct SellItem {
uint256 tokenId;
address payable buyerAddress;
uint256 price;
}
mapping(uint256 => SellItem[]) private SellItems;
uint[] public BlackList;
mapping(uint => bool) public BlackListExist;
WETH eth;
struct userOffer {
uint256 tokenId;
}
mapping(address => userOffer[]) private UserOffers;
// constructor () {
// _disableInitializers();
// }
function initialize(address _WETH) initializer public {
__ERC721_init("ETH Collections", "ETHSTORE");
__Ownable_init();
__UUPSUpgradeable_init();
__Pausable_init();
eth= WETH(payable(_WETH));
admin = msg.sender;
}
//...
My test code is:
describe("Contract Version 1 test", function () {
it("Should return the greeting after deployment", async function () {
const Nft = await ethers.getContractFactory("Nft");
nftContract = await upgrades.deployProxy(Nft, [weth.address], { initializer: 'initialize', kind: 'uups'});
await nftContract.deployed();
expect(1000).to.equal(1000);
});
});
I'm getting this error:
Error: invalid format type (argument="format", value=true, code=INVALID_ARGUMENT, version=abi/5.7.0)
at line `nftContract = await upgrades.deployProxy(Nft, [weth.address], { initializer: 'initialize', kind: 'uups'});`
Thank you for helping me!