Skip to content

Commit 2004be3

Browse files
authored
Merge branch 'main' into solidity-1.5.0-dev
2 parents cd11ab9 + e811db2 commit 2004be3

File tree

4 files changed

+905
-2
lines changed

4 files changed

+905
-2
lines changed

solidity/.openzeppelin/mainnet.json

+270
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,276 @@
16461646
}
16471647
}
16481648
}
1649+
},
1650+
"ce16848058a776a80d070af74d85fb4d1e632b07a9857bddcd0276c13aaf20c6": {
1651+
"address": "0x10Fb5943E2F4F67Ee6a533DaE49B6d4cC443ffE5",
1652+
"txHash": "0xe13747dba11729d2fd7aa9eca5ebba44073591c774122760008a3dd6e2dced76",
1653+
"layout": {
1654+
"solcVersion": "0.8.17",
1655+
"storage": [
1656+
{
1657+
"label": "_initialized",
1658+
"offset": 0,
1659+
"slot": "0",
1660+
"type": "t_uint8",
1661+
"contract": "Initializable",
1662+
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62",
1663+
"retypedFrom": "bool"
1664+
},
1665+
{
1666+
"label": "_initializing",
1667+
"offset": 1,
1668+
"slot": "0",
1669+
"type": "t_bool",
1670+
"contract": "Initializable",
1671+
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67"
1672+
},
1673+
{
1674+
"label": "__gap",
1675+
"offset": 0,
1676+
"slot": "1",
1677+
"type": "t_array(t_uint256)50_storage",
1678+
"contract": "ContextUpgradeable",
1679+
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
1680+
},
1681+
{
1682+
"label": "_owner",
1683+
"offset": 0,
1684+
"slot": "51",
1685+
"type": "t_address",
1686+
"contract": "OwnableUpgradeable",
1687+
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
1688+
},
1689+
{
1690+
"label": "__gap",
1691+
"offset": 0,
1692+
"slot": "52",
1693+
"type": "t_array(t_uint256)49_storage",
1694+
"contract": "OwnableUpgradeable",
1695+
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
1696+
},
1697+
{
1698+
"label": "reimbursementPool",
1699+
"offset": 0,
1700+
"slot": "101",
1701+
"type": "t_contract(ReimbursementPool)8816",
1702+
"contract": "Reimbursable",
1703+
"src": "@keep-network/random-beacon/contracts/Reimbursable.sol:51"
1704+
},
1705+
{
1706+
"label": "__gap",
1707+
"offset": 0,
1708+
"slot": "102",
1709+
"type": "t_array(t_uint256)49_storage",
1710+
"contract": "Reimbursable",
1711+
"src": "@keep-network/random-beacon/contracts/Reimbursable.sol:51"
1712+
},
1713+
{
1714+
"label": "isCoordinator",
1715+
"offset": 0,
1716+
"slot": "151",
1717+
"type": "t_mapping(t_address,t_bool)",
1718+
"contract": "WalletCoordinator",
1719+
"src": "contracts/bridge/WalletCoordinator.sol:150"
1720+
},
1721+
{
1722+
"label": "walletLock",
1723+
"offset": 0,
1724+
"slot": "152",
1725+
"type": "t_mapping(t_bytes20,t_struct(WalletLock)34672_storage)",
1726+
"contract": "WalletCoordinator",
1727+
"src": "contracts/bridge/WalletCoordinator.sol:152"
1728+
},
1729+
{
1730+
"label": "bridge",
1731+
"offset": 0,
1732+
"slot": "153",
1733+
"type": "t_contract(Bridge)25740",
1734+
"contract": "WalletCoordinator",
1735+
"src": "contracts/bridge/WalletCoordinator.sol:154"
1736+
},
1737+
{
1738+
"label": "heartbeatRequestValidity",
1739+
"offset": 20,
1740+
"slot": "153",
1741+
"type": "t_uint32",
1742+
"contract": "WalletCoordinator",
1743+
"src": "contracts/bridge/WalletCoordinator.sol:165"
1744+
},
1745+
{
1746+
"label": "heartbeatRequestGasOffset",
1747+
"offset": 24,
1748+
"slot": "153",
1749+
"type": "t_uint32",
1750+
"contract": "WalletCoordinator",
1751+
"src": "contracts/bridge/WalletCoordinator.sol:169"
1752+
},
1753+
{
1754+
"label": "depositSweepProposalValidity",
1755+
"offset": 28,
1756+
"slot": "153",
1757+
"type": "t_uint32",
1758+
"contract": "WalletCoordinator",
1759+
"src": "contracts/bridge/WalletCoordinator.sol:181"
1760+
},
1761+
{
1762+
"label": "depositMinAge",
1763+
"offset": 0,
1764+
"slot": "154",
1765+
"type": "t_uint32",
1766+
"contract": "WalletCoordinator",
1767+
"src": "contracts/bridge/WalletCoordinator.sol:191"
1768+
},
1769+
{
1770+
"label": "depositRefundSafetyMargin",
1771+
"offset": 4,
1772+
"slot": "154",
1773+
"type": "t_uint32",
1774+
"contract": "WalletCoordinator",
1775+
"src": "contracts/bridge/WalletCoordinator.sol:212"
1776+
},
1777+
{
1778+
"label": "depositSweepMaxSize",
1779+
"offset": 8,
1780+
"slot": "154",
1781+
"type": "t_uint16",
1782+
"contract": "WalletCoordinator",
1783+
"src": "contracts/bridge/WalletCoordinator.sol:214"
1784+
},
1785+
{
1786+
"label": "depositSweepProposalSubmissionGasOffset",
1787+
"offset": 10,
1788+
"slot": "154",
1789+
"type": "t_uint32",
1790+
"contract": "WalletCoordinator",
1791+
"src": "contracts/bridge/WalletCoordinator.sol:218"
1792+
},
1793+
{
1794+
"label": "redemptionProposalValidity",
1795+
"offset": 14,
1796+
"slot": "154",
1797+
"type": "t_uint32",
1798+
"contract": "WalletCoordinator",
1799+
"src": "contracts/bridge/WalletCoordinator.sol:230"
1800+
},
1801+
{
1802+
"label": "redemptionRequestMinAge",
1803+
"offset": 18,
1804+
"slot": "154",
1805+
"type": "t_uint32",
1806+
"contract": "WalletCoordinator",
1807+
"src": "contracts/bridge/WalletCoordinator.sol:238"
1808+
},
1809+
{
1810+
"label": "redemptionRequestTimeoutSafetyMargin",
1811+
"offset": 22,
1812+
"slot": "154",
1813+
"type": "t_uint32",
1814+
"contract": "WalletCoordinator",
1815+
"src": "contracts/bridge/WalletCoordinator.sol:261"
1816+
},
1817+
{
1818+
"label": "redemptionMaxSize",
1819+
"offset": 26,
1820+
"slot": "154",
1821+
"type": "t_uint16",
1822+
"contract": "WalletCoordinator",
1823+
"src": "contracts/bridge/WalletCoordinator.sol:265"
1824+
},
1825+
{
1826+
"label": "redemptionProposalSubmissionGasOffset",
1827+
"offset": 28,
1828+
"slot": "154",
1829+
"type": "t_uint32",
1830+
"contract": "WalletCoordinator",
1831+
"src": "contracts/bridge/WalletCoordinator.sol:274"
1832+
}
1833+
],
1834+
"types": {
1835+
"t_address": {
1836+
"label": "address",
1837+
"numberOfBytes": "20"
1838+
},
1839+
"t_array(t_uint256)49_storage": {
1840+
"label": "uint256[49]",
1841+
"numberOfBytes": "1568"
1842+
},
1843+
"t_array(t_uint256)50_storage": {
1844+
"label": "uint256[50]",
1845+
"numberOfBytes": "1600"
1846+
},
1847+
"t_bool": {
1848+
"label": "bool",
1849+
"numberOfBytes": "1"
1850+
},
1851+
"t_bytes20": {
1852+
"label": "bytes20",
1853+
"numberOfBytes": "20"
1854+
},
1855+
"t_contract(Bridge)25740": {
1856+
"label": "contract Bridge",
1857+
"numberOfBytes": "20"
1858+
},
1859+
"t_contract(ReimbursementPool)8816": {
1860+
"label": "contract ReimbursementPool",
1861+
"numberOfBytes": "20"
1862+
},
1863+
"t_enum(WalletAction)34664": {
1864+
"label": "enum WalletCoordinator.WalletAction",
1865+
"members": [
1866+
"Idle",
1867+
"Heartbeat",
1868+
"DepositSweep",
1869+
"Redemption",
1870+
"MovingFunds",
1871+
"MovedFundsSweep"
1872+
],
1873+
"numberOfBytes": "1"
1874+
},
1875+
"t_mapping(t_address,t_bool)": {
1876+
"label": "mapping(address => bool)",
1877+
"numberOfBytes": "32"
1878+
},
1879+
"t_mapping(t_bytes20,t_struct(WalletLock)34672_storage)": {
1880+
"label": "mapping(bytes20 => struct WalletCoordinator.WalletLock)",
1881+
"numberOfBytes": "32"
1882+
},
1883+
"t_struct(WalletLock)34672_storage": {
1884+
"label": "struct WalletCoordinator.WalletLock",
1885+
"members": [
1886+
{
1887+
"label": "expiresAt",
1888+
"type": "t_uint32",
1889+
"offset": 0,
1890+
"slot": "0"
1891+
},
1892+
{
1893+
"label": "cause",
1894+
"type": "t_enum(WalletAction)34664",
1895+
"offset": 4,
1896+
"slot": "0"
1897+
}
1898+
],
1899+
"numberOfBytes": "32"
1900+
},
1901+
"t_uint16": {
1902+
"label": "uint16",
1903+
"numberOfBytes": "2"
1904+
},
1905+
"t_uint256": {
1906+
"label": "uint256",
1907+
"numberOfBytes": "32"
1908+
},
1909+
"t_uint32": {
1910+
"label": "uint32",
1911+
"numberOfBytes": "4"
1912+
},
1913+
"t_uint8": {
1914+
"label": "uint8",
1915+
"numberOfBytes": "1"
1916+
}
1917+
}
1918+
}
16491919
}
16501920
}
16511921
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import { Artifact, HardhatRuntimeEnvironment } from "hardhat/types"
2+
import { DeployFunction, Deployment } from "hardhat-deploy/types"
3+
import { ContractFactory } from "ethers"
4+
import { ProxyAdmin, WalletCoordinator } from "../typechain"
5+
6+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
7+
const { ethers, helpers, deployments } = hre
8+
9+
const { deployer } = await helpers.signers.getNamedSigners()
10+
11+
const proxyDeployment: Deployment = await deployments.get("WalletCoordinator")
12+
const implementationContractFactory: ContractFactory =
13+
await ethers.getContractFactory("WalletCoordinator", {
14+
signer: deployer,
15+
})
16+
17+
// Deploy new implementation contract
18+
const newImplementationAddress: string = (await hre.upgrades.prepareUpgrade(
19+
proxyDeployment,
20+
implementationContractFactory,
21+
{
22+
kind: "transparent",
23+
}
24+
)) as string
25+
26+
deployments.log(
27+
`new implementation contract deployed at: ${newImplementationAddress}`
28+
)
29+
30+
// Assemble proxy upgrade transaction.
31+
const proxyAdmin: ProxyAdmin =
32+
(await hre.upgrades.admin.getInstance()) as ProxyAdmin
33+
const proxyAdminOwner = await proxyAdmin.owner()
34+
35+
const upgradeTxData = await proxyAdmin.interface.encodeFunctionData(
36+
"upgrade",
37+
[proxyDeployment.address, newImplementationAddress]
38+
)
39+
40+
deployments.log(
41+
`proxy admin owner ${proxyAdminOwner} is required to upgrade proxy implementation with transaction:\n` +
42+
`\t\tfrom: ${proxyAdminOwner}\n` +
43+
`\t\tto: ${proxyAdmin.address}\n` +
44+
`\t\tdata: ${upgradeTxData}`
45+
)
46+
47+
// Update Deployment Artifact
48+
const walletCoordinatorArtifact: Artifact =
49+
hre.artifacts.readArtifactSync("WalletCoordinator")
50+
51+
await deployments.save("WalletCoordinator", {
52+
...proxyDeployment,
53+
abi: walletCoordinatorArtifact.abi,
54+
implementation: newImplementationAddress,
55+
})
56+
57+
// Assemble parameters upgrade transaction.
58+
const walletCoordinator: WalletCoordinator =
59+
await helpers.contracts.getContract("WalletCoordinator")
60+
61+
const walletCoordinatorOwner = await walletCoordinator.owner()
62+
63+
const updateRedemptionProposalParametersTxData =
64+
walletCoordinator.interface.encodeFunctionData(
65+
"updateRedemptionProposalParameters",
66+
[7200, 600, 7200, 20, 20000]
67+
)
68+
69+
deployments.log(
70+
`WalletCoordinator owner ${walletCoordinatorOwner} is required to update redemption proposal parameters with transaction:\n` +
71+
`\t\tfrom: ${walletCoordinatorOwner}\n` +
72+
`\t\tto: ${walletCoordinator.address}\n` +
73+
`\t\tdata: ${updateRedemptionProposalParametersTxData}`
74+
)
75+
76+
if (hre.network.tags.etherscan) {
77+
// We use `verify` instead of `verify:verify` as the `verify` task is defined
78+
// in "@openzeppelin/hardhat-upgrades" to perform Etherscan verification
79+
// of Proxy and Implementation contracts.
80+
await hre.run("verify", {
81+
address: newImplementationAddress,
82+
constructorArgsParams: proxyDeployment.args,
83+
})
84+
}
85+
86+
if (hre.network.tags.tenderly) {
87+
await hre.tenderly.verify({
88+
name: "WalletCoordinator",
89+
address: newImplementationAddress,
90+
})
91+
}
92+
}
93+
94+
export default func
95+
96+
func.tags = ["UpgradeWalletCoordinator"]
97+
// When running an upgrade uncomment the skip below and run the command:
98+
// yarn deploy --tags UpgradeWalletCoordinator --network <NETWORK>
99+
func.skip = async () => true

0 commit comments

Comments
 (0)