Skip to content

Commit

Permalink
feat(script): adding script for deploying all ControllerToken
Browse files Browse the repository at this point in the history
  • Loading branch information
KristenPire committed May 31, 2024
1 parent 381c9d8 commit 14d697e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions script/deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,51 @@ contract All is Script {
}
}

contract AllController is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

vm.startBroadcast(deployerPrivateKey);

BlacklistValidatorUpgradeable blacklistValidator = new BlacklistValidatorUpgradeable();
ERC1967Proxy validatorProxy = new ERC1967Proxy(
address(blacklistValidator),
abi.encodeWithSelector(BlacklistValidatorUpgradeable.initialize.selector)
);

// Deploy only one implementation of the Token contract for all currencies.
ControllerToken implementation = new ControllerToken();

deployTokenProxy(implementation, "Monerium EURe", "EURe", bytes3("EUR"), address(validatorProxy));
deployTokenProxy(implementation, "Monerium GBPe", "GBPe", bytes3("GBP"), address(validatorProxy));
deployTokenProxy(implementation, "Monerium ISKe", "ISKe", bytes3("ISK") ,address(validatorProxy));
deployTokenProxy(implementation, "Monerium USDe", "USDe", bytes3("USD") ,address(validatorProxy));

vm.stopBroadcast();
}

function deployTokenProxy(
ControllerToken implementation,
string memory name,
string memory symbol,
bytes3 _ticker,
address validatorProxy
) internal {
ERC1967Proxy proxy = new ERC1967Proxy(
address(implementation),
abi.encodeWithSelector(
ControllerToken.initialize.selector,
name,
symbol,
_ticker,
validatorProxy
)
);

console.log("Deployed", symbol, "at", address(proxy));
}
}

contract ControllerEUR is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
Expand Down
2 changes: 1 addition & 1 deletion script/deployAll.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi

# Deploying all tokens
echo "Deploying all tokens..."
forge script script/deploy.s.sol:EUR --rpc-url $RPC_URL --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify $VERIFIER_URL -vvvv
forge script script/deploy.s.sol:AllController --rpc-url $RPC_URL --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify $VERIFIER_URL -vvvv --legacy


echo "Deployment process completed."

0 comments on commit 14d697e

Please sign in to comment.