I'm trying to truffle migrate my project and I'm getting this error - https://gyazo.com/999330cf2bb625d1b0881b7cc069e77c
I already tried deleting the builds I had already and doing truffle compile multiple times. I double check the syntax on Box and BoxV2 and can't seem to find why it's spitting out this error.
// contracts/Box.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Box {
uint256 private value;
// Emitted when the stored value changes
event ValueChanged(uint256 _value);
// Stores a new value in the contract
function store(uint256 _value) public {
value = _value;
emit ValueChanged(_value);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return value;
}
}
// contracts/BoxV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract BoxV2 {
uint256 private value;
// Emitted when the stored value changes
event ValueChanged(uint256 _value);
// Stores a new value in the contract
function store(uint256 _value) public {
value = _value;
emit ValueChanged(_value);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return value;
}
// Increments the stored value by 1
function increment() public {
value = value + 1;
emit ValueChanged(value);
}
}
// migrations/3_deploy_upgradeable_box.js
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
const Box = artifacts.require('Box');
module.exports = async function (deployer) {
await deployProxy(Box, [42], { deployer, initializer: 'store' });
};
// migrations/4_upgrade_box.js
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const Box = artifacts.require('Box');
const BoxV2 = artifacts.require('BoxV2');
module.exports = async function (deployer) {
const existing = await Box.deployed();
await upgradeProxy(existing.address, BoxV2, { deployer });
};
Please guide me in the right direction. Thank you.