Skip to content

Commit

Permalink
Merge branch 'main' into solidity-1.5.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
pdyraga committed Jul 6, 2023
2 parents cd11ab9 + e811db2 commit 2004be3
Show file tree
Hide file tree
Showing 4 changed files with 905 additions and 2 deletions.
270 changes: 270 additions & 0 deletions solidity/.openzeppelin/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,276 @@
}
}
}
},
"ce16848058a776a80d070af74d85fb4d1e632b07a9857bddcd0276c13aaf20c6": {
"address": "0x10Fb5943E2F4F67Ee6a533DaE49B6d4cC443ffE5",
"txHash": "0xe13747dba11729d2fd7aa9eca5ebba44073591c774122760008a3dd6e2dced76",
"layout": {
"solcVersion": "0.8.17",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
},
{
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
},
{
"label": "reimbursementPool",
"offset": 0,
"slot": "101",
"type": "t_contract(ReimbursementPool)8816",
"contract": "Reimbursable",
"src": "@keep-network/random-beacon/contracts/Reimbursable.sol:51"
},
{
"label": "__gap",
"offset": 0,
"slot": "102",
"type": "t_array(t_uint256)49_storage",
"contract": "Reimbursable",
"src": "@keep-network/random-beacon/contracts/Reimbursable.sol:51"
},
{
"label": "isCoordinator",
"offset": 0,
"slot": "151",
"type": "t_mapping(t_address,t_bool)",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:150"
},
{
"label": "walletLock",
"offset": 0,
"slot": "152",
"type": "t_mapping(t_bytes20,t_struct(WalletLock)34672_storage)",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:152"
},
{
"label": "bridge",
"offset": 0,
"slot": "153",
"type": "t_contract(Bridge)25740",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:154"
},
{
"label": "heartbeatRequestValidity",
"offset": 20,
"slot": "153",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:165"
},
{
"label": "heartbeatRequestGasOffset",
"offset": 24,
"slot": "153",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:169"
},
{
"label": "depositSweepProposalValidity",
"offset": 28,
"slot": "153",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:181"
},
{
"label": "depositMinAge",
"offset": 0,
"slot": "154",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:191"
},
{
"label": "depositRefundSafetyMargin",
"offset": 4,
"slot": "154",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:212"
},
{
"label": "depositSweepMaxSize",
"offset": 8,
"slot": "154",
"type": "t_uint16",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:214"
},
{
"label": "depositSweepProposalSubmissionGasOffset",
"offset": 10,
"slot": "154",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:218"
},
{
"label": "redemptionProposalValidity",
"offset": 14,
"slot": "154",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:230"
},
{
"label": "redemptionRequestMinAge",
"offset": 18,
"slot": "154",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:238"
},
{
"label": "redemptionRequestTimeoutSafetyMargin",
"offset": 22,
"slot": "154",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:261"
},
{
"label": "redemptionMaxSize",
"offset": 26,
"slot": "154",
"type": "t_uint16",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:265"
},
{
"label": "redemptionProposalSubmissionGasOffset",
"offset": 28,
"slot": "154",
"type": "t_uint32",
"contract": "WalletCoordinator",
"src": "contracts/bridge/WalletCoordinator.sol:274"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes20": {
"label": "bytes20",
"numberOfBytes": "20"
},
"t_contract(Bridge)25740": {
"label": "contract Bridge",
"numberOfBytes": "20"
},
"t_contract(ReimbursementPool)8816": {
"label": "contract ReimbursementPool",
"numberOfBytes": "20"
},
"t_enum(WalletAction)34664": {
"label": "enum WalletCoordinator.WalletAction",
"members": [
"Idle",
"Heartbeat",
"DepositSweep",
"Redemption",
"MovingFunds",
"MovedFundsSweep"
],
"numberOfBytes": "1"
},
"t_mapping(t_address,t_bool)": {
"label": "mapping(address => bool)",
"numberOfBytes": "32"
},
"t_mapping(t_bytes20,t_struct(WalletLock)34672_storage)": {
"label": "mapping(bytes20 => struct WalletCoordinator.WalletLock)",
"numberOfBytes": "32"
},
"t_struct(WalletLock)34672_storage": {
"label": "struct WalletCoordinator.WalletLock",
"members": [
{
"label": "expiresAt",
"type": "t_uint32",
"offset": 0,
"slot": "0"
},
{
"label": "cause",
"type": "t_enum(WalletAction)34664",
"offset": 4,
"slot": "0"
}
],
"numberOfBytes": "32"
},
"t_uint16": {
"label": "uint16",
"numberOfBytes": "2"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint32": {
"label": "uint32",
"numberOfBytes": "4"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
}
}
}
}
}
99 changes: 99 additions & 0 deletions solidity/deploy/81_upgrade_wallet_coordinator_v2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { Artifact, HardhatRuntimeEnvironment } from "hardhat/types"
import { DeployFunction, Deployment } from "hardhat-deploy/types"
import { ContractFactory } from "ethers"
import { ProxyAdmin, WalletCoordinator } from "../typechain"

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { ethers, helpers, deployments } = hre

const { deployer } = await helpers.signers.getNamedSigners()

const proxyDeployment: Deployment = await deployments.get("WalletCoordinator")
const implementationContractFactory: ContractFactory =
await ethers.getContractFactory("WalletCoordinator", {
signer: deployer,
})

// Deploy new implementation contract
const newImplementationAddress: string = (await hre.upgrades.prepareUpgrade(
proxyDeployment,
implementationContractFactory,
{
kind: "transparent",
}
)) as string

deployments.log(
`new implementation contract deployed at: ${newImplementationAddress}`
)

// Assemble proxy upgrade transaction.
const proxyAdmin: ProxyAdmin =
(await hre.upgrades.admin.getInstance()) as ProxyAdmin
const proxyAdminOwner = await proxyAdmin.owner()

const upgradeTxData = await proxyAdmin.interface.encodeFunctionData(
"upgrade",
[proxyDeployment.address, newImplementationAddress]
)

deployments.log(
`proxy admin owner ${proxyAdminOwner} is required to upgrade proxy implementation with transaction:\n` +
`\t\tfrom: ${proxyAdminOwner}\n` +
`\t\tto: ${proxyAdmin.address}\n` +
`\t\tdata: ${upgradeTxData}`
)

// Update Deployment Artifact
const walletCoordinatorArtifact: Artifact =
hre.artifacts.readArtifactSync("WalletCoordinator")

await deployments.save("WalletCoordinator", {
...proxyDeployment,
abi: walletCoordinatorArtifact.abi,
implementation: newImplementationAddress,
})

// Assemble parameters upgrade transaction.
const walletCoordinator: WalletCoordinator =
await helpers.contracts.getContract("WalletCoordinator")

const walletCoordinatorOwner = await walletCoordinator.owner()

const updateRedemptionProposalParametersTxData =
walletCoordinator.interface.encodeFunctionData(
"updateRedemptionProposalParameters",
[7200, 600, 7200, 20, 20000]
)

deployments.log(
`WalletCoordinator owner ${walletCoordinatorOwner} is required to update redemption proposal parameters with transaction:\n` +
`\t\tfrom: ${walletCoordinatorOwner}\n` +
`\t\tto: ${walletCoordinator.address}\n` +
`\t\tdata: ${updateRedemptionProposalParametersTxData}`
)

if (hre.network.tags.etherscan) {
// We use `verify` instead of `verify:verify` as the `verify` task is defined
// in "@openzeppelin/hardhat-upgrades" to perform Etherscan verification
// of Proxy and Implementation contracts.
await hre.run("verify", {
address: newImplementationAddress,
constructorArgsParams: proxyDeployment.args,
})
}

if (hre.network.tags.tenderly) {
await hre.tenderly.verify({
name: "WalletCoordinator",
address: newImplementationAddress,
})
}
}

export default func

func.tags = ["UpgradeWalletCoordinator"]
// When running an upgrade uncomment the skip below and run the command:
// yarn deploy --tags UpgradeWalletCoordinator --network <NETWORK>
func.skip = async () => true
Loading

0 comments on commit 2004be3

Please sign in to comment.