I have an upgradeable contract, but when I upgrade it, it doesn't go to the same address.
After I deploy the upgrade, the console shows TransparentUpgradeableProxy getting a new address, but that address does not have the functionality added in the upgraded contract nor the same tokens already created in the new contract. It does, however, have the functionality of the old contract.
Below are my deployment scripts:
1_deploy_upgradeable_Placeholder.js
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
const Placeholder = artifacts.require('Placeholder');
module.exports = async function (deployer) {
const instance = await deployProxy(Placeholder, { deployer });
console.log('Deployed', instance.address);
};
and:
//2_upgrade_AlmaNFT.js
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
const Placeholder = artifacts.require('Placeholder');
const Placeholderv2 = artifacts.require('Placeholderv2');
module.exports = async function (deployer) {
const existing = await Placeholder.deployed();
await upgradeProxy(existing.address, Placeholderv2, { deployer });
};
I interact with them through the truffle console, and use
const place = Placeholder.at(TransparentUpgradeableProxy address)
after which I perform functions like so:
place.function()
What am I doing wrong?
const place = Placeholder.at(TransparentUpgradeableProxy address)