I want to use the truffle-upgrades
plug-in to call await admin.getInstance()
in a script run via truffle exec
. I don’t want to use await ProxyAdmin.at()
because I want to get the proxy admin without requiring the address. Is there any way to do this?
Please explain in more detail the problem you’re running into.
I don’t think truffle-upgrades supports truffle exec
. There are some important global variables that Truffle does not inject in the exec environment. This may be the reason why it’s not working.
Yes, that seems to be the case. I worked around it by extracting what I needed to a temporary text file within a truffle migrate
script:
const fs = require('fs');
const os = require("os");
fs.appendFile('./contracts.txt', `MyContract@${await (await admin.getInstance()).getProxyImplementation(proxy.address)}` + os.EOL, (err) => { if (err) { console.log(err); } });
The purpose is to use the list of contract names in a PowerShell script after deployment to verify all my contracts automatically. So, just to automate the pipeline.
Ok yeah.
If you’re using the most recent versions of the plugins, you will probably find all the addresses that you want in the network file in the .openzeppelin
directory.