-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1060 from NexusMutual/chore/testnet-member-join-f…
…unction Add testnet MR patching code
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "../../modules/governance/MemberRoles.sol"; | ||
|
||
contract TestnetMemberRoles is MemberRoles { | ||
|
||
constructor(address tokenAddress) MemberRoles(tokenAddress) { | ||
} | ||
|
||
function joinOnTestnet(address _userAddress) public { | ||
|
||
require(!isMember(_userAddress), "MemberRoles: This address is already a member"); | ||
|
||
tokenController().addToWhitelist(_userAddress); | ||
_updateRole(_userAddress, uint(Role.Member), true); | ||
|
||
emit MemberJoined(_userAddress, 0); | ||
} | ||
|
||
} |
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,30 @@ | ||
const { ethers, network } = require('hardhat'); | ||
|
||
const MR = '0x055CC48f7968FD8640EF140610dd4038e1b03926'; | ||
const TK = '0xd7c49CEE7E9188cCa6AD8FF264C1DA2e69D4Cf3B'; | ||
|
||
const main = async () => { | ||
console.log(`Starting patch script on ${network.name} network`); | ||
|
||
const mrProxy = await ethers.getContractAt('OwnedUpgradeabilityProxy', MR); | ||
|
||
console.log('Reading owner'); | ||
const owner = await mrProxy.proxyOwner(); | ||
|
||
console.log('Getting a signer'); | ||
const [signer] = await ethers.getSigners(); | ||
|
||
console.log('Deploying new implementation contract'); | ||
const mrImplementation = await ethers.deployContract('TestnetMemberRoles', [TK], signer); | ||
|
||
console.log('Upgrading proxy'); | ||
const provider = new ethers.providers.JsonRpcProvider(network.config.url); | ||
const mrProxyAsOwner = new ethers.Contract(MR, mrProxy.interface, provider.getSigner(owner)); | ||
await mrProxyAsOwner.upgradeTo(mrImplementation.address); | ||
}; | ||
main() | ||
.then(() => process.exit(0)) | ||
.catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |