forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ETH app upgradeability (paritytech#554)
* ETHApp upgradeability and test * upgradeable erc20 app * upgradeable erc721 app * upgradeable DOT app * add upgrade task * add renounce task * add events * CHANNEL_UPGRADE_ROLE can change CHANNEL_UPGRADE_ROLE * Fix spelling
- Loading branch information
1 parent
31ae72d
commit 5f02215
Showing
14 changed files
with
448 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { task } from "hardhat/config"; | ||
import { TaskArguments } from "hardhat/types"; | ||
|
||
task("renounce") | ||
.addParam("appaddr", "The app you want to renounce ownership of") | ||
.setAction(async ({appaddr}: TaskArguments, { ethers }) => { | ||
const accounts = await ethers.getSigners(); | ||
const app = await ethers.getContractAt(["function renounceRole(bytes32 role, address account)"], appaddr) | ||
const tx = await app.renounceRole(ethers.utils.keccak256(ethers.utils.toUtf8Bytes("CHANNEL_UPGRADE_ROLE")), accounts[0].address); | ||
console.log(`tx submitted... https://etherscan.io/tx/${tx.hash}`); | ||
const receipt = await tx.wait(); | ||
console.log(`tx mined, receipt:`); | ||
console.log(JSON.stringify(receipt, undefined, 2)) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Signer } from "@ethersproject/abstract-signer"; | ||
import { task } from "hardhat/config"; | ||
import { TaskArguments } from "hardhat/types"; | ||
task("upgrade") | ||
.addParam("appaddr", "The app you want to upgrade") | ||
.addParam("basicinbound") | ||
.addParam("basicoutbound") | ||
.addParam("incinbound") | ||
.addParam("incoutbound") | ||
.setAction(async ({appaddr, basicinbound, basicoutbound, incinbound, incoutbound}: TaskArguments, { ethers }) => { | ||
const accounts: Signer[] = await ethers.getSigners(); | ||
const app = await ethers.getContractAt(["function upgrade(tuple(address inbound, address outbound) _basic, tuple(address inbound, address outbound) _incentivized)"], appaddr) | ||
const tx = await app.upgrade( | ||
[basicinbound, basicoutbound], | ||
[incinbound, incoutbound] | ||
); | ||
console.log(`tx submitted... https://etherscan.io/tx/${tx.hash}`); | ||
const receipt = await tx.wait(); | ||
console.log(`tx mined, receipt:`); | ||
console.log(JSON.stringify(receipt, undefined, 2)) | ||
}); |
Oops, something went wrong.