Skip to content

Commit

Permalink
changing proxy admin ownership should now work
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsmkl committed Jul 22, 2022
1 parent 31bcc09 commit 70920e2
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/token/erc721/NFT721Upgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import '../NFTBase.sol';
contract NFT721Upgradeable is ERC721Upgradeable, NFTBase {

// solhint-disable-next-line
function initialize(
function initializeWithName(
string memory name,
string memory symbol
)
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/erc721/POAPUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract POAPUpgradeable is NFT721Upgradeable, ERC721URIStorageUpgradeable, ERC7
AccessControlUpgradeable._setupRole(MINTER_ROLE, msg.sender); }

// solhint-disable-next-line
function initialize(
function initializeWithName(
string memory name,
string memory symbol
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async function zosCreate({ contract, args, libraries, verbose, ctx }) {
console.log(`${contract}: ${c.address}`)
}
addresses[contract] = c.address
console.log(await ethers.provider.getStorageAt(c.address, '0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103'))
return c.address
}
}
Expand Down
55 changes: 52 additions & 3 deletions scripts/deploy/truffle-wrapper/deployContracts.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,53 @@
const initializeContracts = require('./deploy/initializeContracts.js')
const setupContracts = require('./deploy/setupContracts.js')
const evaluateContracts = require('./evaluateContracts.js')
const { ethers, upgrades, web3 } = require('hardhat')
const { ethers, web3 } = require('hardhat')
const { exportArtifacts, exportLibraryArtifacts } = require('./artifacts')
const { loadWallet } = require('./wallets.js')
const { readArtifact } = require('./artifacts')

const PROXY_ADMIN_ABI = `[{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}, {
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}]`

const PROXY_ABI = `[{
"inputs": [],
"name": "admin",
"outputs": [
{
"internalType": "address",
"name": "admin_",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}]`

async function deployLibrary(name, addresses) {
if (addresses[name]) {
console.log(`Contract ${name} found from cache`)
Expand Down Expand Up @@ -69,9 +111,16 @@ async function deployContracts({ contracts: origContracts, verbose, testnet, mak

// Move proxy admin to upgrader wallet
try {
await upgrades.admin.transferProxyAdminOwnership(roles.upgraderWallet)
const addr = await ethers.provider.getStorageAt(addressBook.DIDRegistry, '0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103')
console.log('got admin', addr)
const admin = new ethers.Contract('0x' + addr.substring(26), PROXY_ADMIN_ABI, ethers.provider)
const adminOwner = await admin.owner()
console.log('admin owner', adminOwner)
const signer = ethers.provider.getSigner(adminOwner)
await admin.connect(signer).transferOwnership(roles.upgraderWallet)
// await upgrades.admin.transferProxyAdminOwnership(roles.upgraderWallet)
} catch (err) {
console.log('Cannot move proxy admin ownership')
console.log('Cannot move proxy admin ownership', err)
}

addressBook.DIDRegistryLibrary = didRegistryLibraryAddress
Expand Down

0 comments on commit 70920e2

Please sign in to comment.