Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tokenMultiplierSetter role to deployment scripts (#683) #695

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion l1-contracts/deploy-scripts/AcceptAdmin.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ contract AcceptAdmin is Script {
_salt: bytes32(0),
_target: target,
_data: abi.encodeCall(adminContract.acceptAdmin, ()),
_value: 0
_value: 0,
_delay: 0
});
}

Expand All @@ -46,4 +47,13 @@ contract AcceptAdmin is Script {
chainAdmin.multicall(calls, true);
vm.stopBroadcast();
}

// This function should be called by the owner to update token multiplier setter role
function chainSetTokenMultiplierSetter(address chainAdmin, address target) public {
IChainAdmin admin = IChainAdmin(chainAdmin);

vm.startBroadcast();
admin.setTokenMultiplierSetter(target);
vm.stopBroadcast();
}
}
7 changes: 7 additions & 0 deletions l1-contracts/scripts/register-hyperchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ async function main() {
.option("--base-token-name <base-token-name>")
.option("--base-token-address <base-token-address>")
.option("--use-governance <use-governance>")
.option("--token-multiplier-setter-address <token-multiplier-setter-address>")
.action(async (cmd) => {
const deployWallet = cmd.privateKey
? new Wallet(cmd.privateKey, provider)
Expand Down Expand Up @@ -106,7 +107,13 @@ async function main() {
await deployer.registerToken(baseTokenAddress, useGovernance);
}

const tokenMultiplierSetterAddress = cmd.tokenMultiplierSetterAddress || "";

await deployer.registerHyperchain(baseTokenAddress, cmd.validiumMode, null, gasPrice, useGovernance);
if (tokenMultiplierSetterAddress != "") {
console.log(`Using token multiplier setter address: ${tokenMultiplierSetterAddress}`);
await deployer.setTokenMultiplierSetterAddress(tokenMultiplierSetterAddress);
}
await deployer.transferAdminFromDeployerToChainAdmin();
});

Expand Down
11 changes: 11 additions & 0 deletions l1-contracts/src.ts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,17 @@ export class Deployer {
}
}

public async setTokenMultiplierSetterAddress(tokenMultiplierSetterAddress: string) {
const chainAdmin = ChainAdminFactory.connect(this.addresses.ChainAdmin, this.deployWallet);

const receipt = await (await chainAdmin.setTokenMultiplierSetter(tokenMultiplierSetterAddress)).wait();
if (this.verbose) {
console.log(
`Token multiplier setter set as ${tokenMultiplierSetterAddress}, gas used: ${receipt.gasUsed.toString()}`
);
}
}

public async transferAdminFromDeployerToChainAdmin() {
const stm = this.stateTransitionManagerContract(this.deployWallet);
const diamondProxyAddress = await stm.getHyperchain(this.chainId);
Expand Down
110 changes: 110 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,11 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.4.0.tgz#bbb43f0e01f40839b0bd38c2c443cb6910ae955f"
integrity sha512-7+rraFk9tCqvfemv9Ita5vTlSBAeO/S5aDKOgGRgYt0JEKZlrX161nDW6UfzMPxWl9GOLEDUzCEaYuNmXseUlg==

"@nomicfoundation/[email protected]":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.5.0.tgz#08b7302c7ce00e3c4dc43e7cfc9065997463c470"
integrity sha512-G6OX/PESdfU4ZOyJ4MDh4eevW0wt2mduuxA+thXtTcStOiQTtPuV205h4kLOR5wRB1Zz6Zy0LedTMax7TzOtGw==

"@nomicfoundation/[email protected]":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.3.7.tgz#c3b394445084270cc5250d6c1869b0574e7ef810"
Expand All @@ -891,6 +896,11 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.4.0.tgz#b1ffcd9142418fd8498de34a7336b3f977907c86"
integrity sha512-+Hrc0mP9L6vhICJSfyGo/2taOToy1AIzVZawO3lU8Lf7oDQXfhQ4UkZnkWAs9SVu1eUwHUGGGE0qB8644piYgg==

"@nomicfoundation/[email protected]":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.5.0.tgz#4a30a8584721bffd1ad6d7cc7fb70f2b2034e3b5"
integrity sha512-fI7uHfHqPtdPZjkFUTpotc/F5gGv41ws+jSZy9+2AR9RDMOAIXMEArOx9rGLBcevWu8SFnyH/l/77kG/5FXbDw==

"@nomicfoundation/[email protected]":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.3.7.tgz#6d65545a44d1323bb7ab08c3306947165d2071de"
Expand All @@ -901,6 +911,11 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.4.0.tgz#8173d16d4f6f2b3e82ba7096d2a1ea3619d8bfa7"
integrity sha512-4HUDMchNClQrVRfVTqBeSX92hM/3khCgpZkXP52qrnJPqgbdCxosOehlQYZ65wu0b/kaaZSyvACgvCLSQ5oSzQ==

"@nomicfoundation/[email protected]":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.5.0.tgz#f4a0e9a5ac8157dc4e241f751c8e8b09f446aa8d"
integrity sha512-eMC3sWPkBZILg2/YB4Xv6IR0nggCLt5hS8K8jjHeGEeUs9pf8poBF2Oy+G4lSu0YLLjexGzHypz9/P+pIuxZHw==

"@nomicfoundation/[email protected]":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.3.7.tgz#5368534bceac1a8c18b1be6b908caca5d39b0c03"
Expand All @@ -911,6 +926,11 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.4.0.tgz#b1ce293a7c3e0d9f70391e1aef1a82b83b997567"
integrity sha512-D4J935ZRL8xfnP3zIFlCI9jXInJ0loDUkCTLeCEbOf2uuDumWDghKNQlF1itUS+EHaR1pFVBbuwqq8hVK0dASg==

"@nomicfoundation/[email protected]":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.5.0.tgz#34e240a02ebb8d6e0e262642058370f24d555386"
integrity sha512-yPK0tKjYRxe5ktggFr8aBHH0DCI9uafuaD8QuzyrQAfSf/m/ebTdgthROdbYp6eRk5mJyfAQT/45fM3tnlYsWw==

"@nomicfoundation/[email protected]":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.3.7.tgz#42349bf5941dbb54a5719942924c6e4e8cde348e"
Expand All @@ -921,6 +941,11 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.4.0.tgz#4c12c4e4bfd3d837f5663ad7cbf7cb6d5634ef83"
integrity sha512-6x7HPy+uN5Cb9N77e2XMmT6+QSJ+7mRbHnhkGJ8jm4cZvWuj2Io7npOaeHQ3YHK+TiQpTnlbkjoOIpEwpY3XZA==

"@nomicfoundation/[email protected]":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.5.0.tgz#c118f26567eba994133c7fda11a022dee46c5e13"
integrity sha512-Hds8CRYi4DEyuErjcwUNSvNpMzmOYUihW4qYCoKgSBUVS5saX1PyPYvFYuYpeU5J8/T2iMk6yAPVLCxtKbgnKg==

"@nomicfoundation/[email protected]":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.3.7.tgz#e6babe11c9a8012f1284e6e48c3551861f2a7cd4"
Expand All @@ -931,6 +956,11 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.4.0.tgz#8842004aa1a47c504f10863687da28b65dca7baa"
integrity sha512-3HFIJSXgyubOiaN4MWGXx2xhTnhwlJk0PiSYNf9+L/fjBtcRkb2nM910ZJHTvqCb6OT98cUnaKuAYdXIW2amgw==

"@nomicfoundation/[email protected]":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.5.0.tgz#b437a652ead59186b566fc2c7a45278018d85806"
integrity sha512-1hXMDSzdyh5ojwO3ZSRbt7t5KKYycGUlFdC3lgJRZ7gStB8xjb7RA3hZn2csn9OydS950Ne4nh+puNq91iXApw==

"@nomicfoundation/[email protected]":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.3.7.tgz#1504b98f305f03be153b0220a546985660de9dc6"
Expand All @@ -941,6 +971,11 @@
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.4.0.tgz#29d8bbb2edf9912a95f5453855cf17cdcb269957"
integrity sha512-CP4GsllEfXEz+lidcGYxKe5rDJ60TM5/blB5z/04ELVvw6/CK9eLcYeku7HV0jvV7VE6dADYKSdQyUkvd0El+A==

"@nomicfoundation/[email protected]":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.5.0.tgz#0dd0eb9c0d6c2f47403393b9712dd8577bd06041"
integrity sha512-CFagD423400xXkRmACIR13FoocN48qi4ogRnuFQIvBDtEE3aMEajfFj4bycmQQDqnqChsZy/jwD4OxbX6oaNJw==

"@nomicfoundation/edr@^0.3.1":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.3.7.tgz#9c75edf1fcf601617905b2c89acf103f4786d017"
Expand All @@ -967,6 +1002,19 @@
"@nomicfoundation/edr-linux-x64-musl" "0.4.0"
"@nomicfoundation/edr-win32-x64-msvc" "0.4.0"

"@nomicfoundation/edr@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.5.0.tgz#febcce36898ae3e01f04f2013a24b8bec0c2ca24"
integrity sha512-nAUyjGhxntXje/1AkDX9POfH+pqUxdi4XHzIhaf/dJYs7fgAFxL3STBK1OYcA3LR7vtiylLHMz7wxjqLzlLGKg==
dependencies:
"@nomicfoundation/edr-darwin-arm64" "0.5.0"
"@nomicfoundation/edr-darwin-x64" "0.5.0"
"@nomicfoundation/edr-linux-arm64-gnu" "0.5.0"
"@nomicfoundation/edr-linux-arm64-musl" "0.5.0"
"@nomicfoundation/edr-linux-x64-gnu" "0.5.0"
"@nomicfoundation/edr-linux-x64-musl" "0.5.0"
"@nomicfoundation/edr-win32-x64-msvc" "0.5.0"

"@nomicfoundation/[email protected]":
version "4.0.4"
resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz#9901f513af2d4802da87c66d6f255b510bef5acb"
Expand Down Expand Up @@ -4259,6 +4307,55 @@ hardhat@=2.22.2:
uuid "^8.3.2"
ws "^7.4.6"

hardhat@^2.14.0:
version "2.22.7"
resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.7.tgz#3de0ce5074063cf468876c5e62f84c66d2408e8e"
integrity sha512-nrXQAl+qUr75TsCLDo8P41YXLc+5U7qQMMCIrbbmy1/uQaVPncdjDrD5BR0CENvHRj7EBqO+JkofpozXoIfJKg==
dependencies:
"@ethersproject/abi" "^5.1.2"
"@metamask/eth-sig-util" "^4.0.0"
"@nomicfoundation/edr" "^0.5.0"
"@nomicfoundation/ethereumjs-common" "4.0.4"
"@nomicfoundation/ethereumjs-tx" "5.0.4"
"@nomicfoundation/ethereumjs-util" "9.0.4"
"@nomicfoundation/solidity-analyzer" "^0.1.0"
"@sentry/node" "^5.18.1"
"@types/bn.js" "^5.1.0"
"@types/lru-cache" "^5.1.0"
adm-zip "^0.4.16"
aggregate-error "^3.0.0"
ansi-escapes "^4.3.0"
boxen "^5.1.2"
chalk "^2.4.2"
chokidar "^3.4.0"
ci-info "^2.0.0"
debug "^4.1.1"
enquirer "^2.3.0"
env-paths "^2.2.0"
ethereum-cryptography "^1.0.3"
ethereumjs-abi "^0.6.8"
find-up "^2.1.0"
fp-ts "1.19.3"
fs-extra "^7.0.1"
glob "7.2.0"
immutable "^4.0.0-rc.12"
io-ts "1.10.4"
keccak "^3.0.2"
lodash "^4.17.11"
mnemonist "^0.38.0"
mocha "^10.0.0"
p-map "^4.0.0"
raw-body "^2.4.1"
resolve "1.17.0"
semver "^6.3.0"
solc "0.8.26"
source-map-support "^0.5.13"
stacktrace-parser "^0.1.10"
tsort "0.0.1"
undici "^5.14.0"
uuid "^8.3.2"
ws "^7.4.6"

hardhat@^2.18.3, hardhat@^2.19.4:
version "2.22.5"
resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.5.tgz#7e1a4311fa9e34a1cfe337784eae06706f6469a5"
Expand Down Expand Up @@ -6527,6 +6624,19 @@ [email protected]:
semver "^5.5.0"
tmp "0.0.33"

[email protected]:
version "0.8.26"
resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a"
integrity sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g==
dependencies:
command-exists "^1.2.8"
commander "^8.1.0"
follow-redirects "^1.12.1"
js-sha3 "0.8.0"
memorystream "^0.3.1"
semver "^5.5.0"
tmp "0.0.33"

solhint-plugin-prettier@^0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/solhint-plugin-prettier/-/solhint-plugin-prettier-0.0.5.tgz#e3b22800ba435cd640a9eca805a7f8bc3e3e6a6b"
Expand Down
Loading