Skip to content

Commit

Permalink
feat: redeploy to testnets and update upgrade script
Browse files Browse the repository at this point in the history
  • Loading branch information
scolear committed Sep 26, 2024
1 parent b4622fe commit 9c2375d
Show file tree
Hide file tree
Showing 8 changed files with 2,897 additions and 3,241 deletions.
496 changes: 486 additions & 10 deletions .openzeppelin/base-sepolia.json

Large diffs are not rendered by default.

496 changes: 486 additions & 10 deletions .openzeppelin/sepolia.json

Large diffs are not rendered by default.

496 changes: 486 additions & 10 deletions .openzeppelin/unknown-421614.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions deploymentFiles/arbsepolia/DLCManager.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "arbsepolia",
"updatedAt": "2024-09-18T15:16:21.428Z",
"gitSHA": "ce5f215",
"updatedAt": "2024-09-26T17:49:57.073Z",
"gitSHA": "b4622fe",
"contract": {
"name": "DLCManager",
"address": "0xE8FA6399d1b60968f04888F23Ed13Ed499C1Fd51",
Expand All @@ -17,12 +17,14 @@
"error DepositTooLarge(uint256 deposit, uint256 maximumDeposit)",
"error DepositTooSmall(uint256 deposit, uint256 minimumDeposit)",
"error DuplicateSignature()",
"error DuplicateSigner(address signer)",
"error FeeRateOutOfBounds(uint256 feeRate)",
"error IncompatibleRoles()",
"error InsufficientMintedBalance(uint256 minted, uint256 amount)",
"error InsufficientTokenBalance(uint256 balance, uint256 amount)",
"error InvalidRange()",
"error InvalidSigner()",
"error NoSignerRenouncement()",
"error NotCreatorContract()",
"error NotDLCAdmin()",
"error NotEnoughSignatures()",
Expand Down
6 changes: 4 additions & 2 deletions deploymentFiles/basesepolia/DLCManager.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "basesepolia",
"updatedAt": "2024-09-18T15:15:32.790Z",
"gitSHA": "ce5f215",
"updatedAt": "2024-09-26T14:51:22.898Z",
"gitSHA": "b4622fe",
"contract": {
"name": "DLCManager",
"address": "0x050C24dBf1eEc17babE5fc585F06116A259CC77A",
Expand All @@ -17,12 +17,14 @@
"error DepositTooLarge(uint256 deposit, uint256 maximumDeposit)",
"error DepositTooSmall(uint256 deposit, uint256 minimumDeposit)",
"error DuplicateSignature()",
"error DuplicateSigner(address signer)",
"error FeeRateOutOfBounds(uint256 feeRate)",
"error IncompatibleRoles()",
"error InsufficientMintedBalance(uint256 minted, uint256 amount)",
"error InsufficientTokenBalance(uint256 balance, uint256 amount)",
"error InvalidRange()",
"error InvalidSigner()",
"error NoSignerRenouncement()",
"error NotCreatorContract()",
"error NotDLCAdmin()",
"error NotEnoughSignatures()",
Expand Down
6 changes: 4 additions & 2 deletions deploymentFiles/sepolia/DLCManager.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "sepolia",
"updatedAt": "2024-09-18T15:22:32.790Z",
"gitSHA": "ce5f215",
"updatedAt": "2024-09-26T15:29:31.672Z",
"gitSHA": "b4622fe",
"contract": {
"name": "DLCManager",
"address": "0x2bAa7E92F3F14883264BfA63058cC223Ad719438",
Expand All @@ -17,12 +17,14 @@
"error DepositTooLarge(uint256 deposit, uint256 maximumDeposit)",
"error DepositTooSmall(uint256 deposit, uint256 minimumDeposit)",
"error DuplicateSignature()",
"error DuplicateSigner(address signer)",
"error FeeRateOutOfBounds(uint256 feeRate)",
"error IncompatibleRoles()",
"error InsufficientMintedBalance(uint256 minted, uint256 amount)",
"error InsufficientTokenBalance(uint256 balance, uint256 amount)",
"error InvalidRange()",
"error InvalidSigner()",
"error NoSignerRenouncement()",
"error NotCreatorContract()",
"error NotDLCAdmin()",
"error NotEnoughSignatures()",
Expand Down
4,547 changes: 1,359 additions & 3,188 deletions package-lock.json

Large diffs are not rendered by default.

85 changes: 68 additions & 17 deletions scripts/50_contract-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,31 @@ module.exports = async function contractAdmin() {
contractName,
network
);
const proxyAdminAddress =
await hardhat.upgrades.erc1967.getAdminAddress(proxyAddress);

const proxyAdmin = new hardhat.ethers.Contract(
proxyAdminAddress,
['function owner() view returns (address)'],
deployer
);
const proxyAdminOwner = await proxyAdmin.owner();
console.log('ProxyAdmin owner:', proxyAdminOwner);

const newImplementation =
await hardhat.ethers.getContractFactory(contractName);
const newImplementationAddress =
await hardhat.upgrades.prepareUpgrade(
proxyAddress,
newImplementation
);
console.log('New implementation address', newImplementationAddress);

try {
if (proxyAdminOwner == deployer) {
console.log('deployer is ProxyAdmin owner, continuing...');
await hardhat.upgrades.upgradeProxy(
proxyAddress,
newImplementation
newImplementation,
{
txOverrides: {
maxFeePerGas: 1000000000,
maxPriorityFeePerGas: 1000000000,
},
}
);
console.log('Upgraded contract', contractName);
console.log('Updating DeploymentInfo...');
Expand All @@ -232,18 +244,57 @@ module.exports = async function contractAdmin() {
} catch (error) {
console.error(error);
}
} catch (error) {
console.error(error);
console.log(chalk.bgYellow('Upgrade through the SAFE!'));
} else {
const newImplementationAddress =
await hardhat.upgrades.prepareUpgrade(
proxyAddress,
newImplementation,
{ timeout: 120 }
);
console.log(
'Dont forget to update the deployment info afterwards:'
);
const implObject = await hardhat.ethers.getContractAt(
contractName,
'New implementation address',
newImplementationAddress
);
const dI = deploymentInfo(network, implObject, contractName);
console.log(dI);

try {
await hardhat.upgrades.upgradeProxy(
proxyAddress,
newImplementation
);
console.log('Upgraded contract', contractName);
console.log('Updating DeploymentInfo...');
try {
const contractObject =
await hardhat.ethers.getContractAt(
contractName,
proxyAddress
);
await saveDeploymentInfo(
deploymentInfo(
network,
contractObject,
contractName
)
);
} catch (error) {
console.error(error);
}
} catch (error) {
console.error(error);
console.log(chalk.bgYellow('Upgrade through the SAFE!'));
const implObject = await hardhat.ethers.getContractAt(
contractName,
newImplementationAddress
);
const deploymentInfoToSave = deploymentInfo(
network,
{ ...implObject, address: proxyAddress },
contractName
);
await saveDeploymentInfo(deploymentInfoToSave);
console.log(deploymentInfoToSave);
console.log(chalk.bgRed('Upgrade through the SAFE!'));
}
}

break;
Expand Down

0 comments on commit 9c2375d

Please sign in to comment.