Skip to content

Commit

Permalink
Merge pull request #1060 from NexusMutual/chore/testnet-member-join-f…
Browse files Browse the repository at this point in the history
…unction

Add testnet MR patching code
  • Loading branch information
roxdanila authored Mar 19, 2024
2 parents 5d11b63 + 2ac90a9 commit 4dd1d9b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
22 changes: 22 additions & 0 deletions contracts/mocks/Testnet/TestnetMemberRoles.sol
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);
}

}
30 changes: 30 additions & 0 deletions scripts/deploy/whitelist.js
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);
});

0 comments on commit 4dd1d9b

Please sign in to comment.