diff --git a/contracts/mocks/Testnet/TestnetMemberRoles.sol b/contracts/mocks/Testnet/TestnetMemberRoles.sol new file mode 100644 index 0000000000..6382576542 --- /dev/null +++ b/contracts/mocks/Testnet/TestnetMemberRoles.sol @@ -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); + } + +} diff --git a/scripts/deploy/whitelist.js b/scripts/deploy/whitelist.js new file mode 100644 index 0000000000..ea6bd224b0 --- /dev/null +++ b/scripts/deploy/whitelist.js @@ -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); + });