I'm trying to deploy an upgradeable contract. When I use hardhat to deploy locally, the initialization works fine. When I use hardhat to deploy on rinkeby, the name and owner are empty. I've read lots of posts on here, but can't find a solution. Help please? Thank you.
Here's my code:
import '@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol';
import './Base64.sol';
contract Burger is
Initializable,
ERC721Upgradeable,
ERC721EnumerableUpgradeable,
ERC721URIStorageUpgradeable,
PausableUpgradeable,
OwnableUpgradeable,
ERC721BurnableUpgradeable,
ReentrancyGuardUpgradeable
{
using CountersUpgradeable for CountersUpgradeable.Counter;
CountersUpgradeable.Counter private _tokenIdCounter;
struct Burg {
address recipientAddress;
address providerAddress;
string name;
}
uint256 public price;
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC721_init("Burger", "BURG");
__ERC721Enumerable_init();
__ERC721URIStorage_init();
__Pausable_init();
__Ownable_init();
__ERC721Burnable_init();
price = 0.001 ether;
}
Also, here's my deploy script:
async function main() {
const Contract = await ethers.getContractFactory('Burger');
console.log('Deploying...');
const contract = await upgrades.deployProxy(Contract);
await contract.deployed();
console.log('Deployed to:', contract.address);
}
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
I tried changing my inits to have _unchained at the end, but that didn't help.
Thanks for any help.