How to use admin.changeAdminForProxy from Truffle console?

Hi! What is the proper way to change the admin of the proxy from the Truffle console?

I’ve deployed an upgradeable contract using a temporary address, and would like to set the ownership on a secure account.

Using the following code on the console
const { admin } = require('@openzeppelin/truffle-upgrades') await admin.transferProxyAdminOwnership(new_owner)
returns the following error:
Thrown: Error: Global Truffle config not found: Truffle >=5.1.35 is required. Truffle exec not yet supported

Thank you!

2 Likes

Hi @Eibriel,

Are you using a version of Truffle that it >= 5.1.35? You can check with npx truffle version (if installed locally).

Otherwise what you are doing looks ok.

See the documentation:

https://docs.openzeppelin.com/upgrades-plugins/1.x/api-truffle-upgrades#admin-transfer-proxy-admin-ownership

Guide using Hardhat to transfer control to a MultiSig.
https://docs.openzeppelin.com/upgrades-plugins/1.x/api-truffle-upgrades#admin-transfer-proxy-admin-ownership

1 Like