Closed code-ishwar closed 4 years ago
Hi Folks, Any help will be greatly appreciated.
I have also tried this, but it returns new address every time. I think that it means salt isn't working. can someone please help. There is no documentation and no active dev forums.
const instance = await project.createProxyWithSalt(MyContractV0,"872354");
@thesolyd Can you share more context about your code? How are you instantiating project
?
Our forum is http://forum.openzeppelin.com by the way, and it is definitely active.
Hi @frangio Here is the code. Every contract is generated at new address. Although I expected that address would have gotten fixed due to salt.
const Web3 = require('web3');
const { Contracts, ProxyAdminProject, ZWeb3 } = require('@openzeppelin/upgrades')
async function main() {
// Create web3 provider and initialize OpenZeppelin upgrades
const web3 = new Web3('http://localhost:8545');
ZWeb3.initialize(web3.currentProvider)
// Create an OpenZeppelin project
const [from] = await ZWeb3.eth.getAccounts();
const project = new ProxyAdminProject('MyProject', null, null, { from, gas: 1e6, gasPrice: 1e9 });
// Deploy an instance of MyContractV0
console.log('Creating an upgradeable instance of v0...');
const MyContractV0 = Contracts.getFromLocal('MyContractV0');
let salt = '8';
const instance = await project.createProxyWithSalt(MyContractV0, salt);
const address = instance.options.address;
console.log(`Contract created at ${address}`);
}
main();
The error may be the one described in https://github.com/OpenZeppelin/openzeppelin-sdk/pull/788#issuecomment-655707762.
Thanks
Maybe this is a noob question. But I searched thouroughly in google and past issues, but couldn't find any help.
const instance = await project.createProxy(MyContractV0, {salt:8});
Once I set salt in createProxy, it doesn't create a unique address. I expected that it will freeze the address, but that is not so. Everytime, it generates a new address. Is it expected? How to use salt pr what it's intended usage?
TIA