From 66b149888fae6ab17cbe5c5c21a6c550ff4d207a Mon Sep 17 00:00:00 2001 From: has5aan Date: Fri, 22 Dec 2023 12:26:02 +0100 Subject: [PATCH] Transfers ownership of L1LiskToken contract to configured address after deployment --- script/L1LiskToken.s.sol | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/L1LiskToken.s.sol b/script/L1LiskToken.s.sol index f7599b1d..3c2d1e5a 100644 --- a/script/L1LiskToken.s.sol +++ b/script/L1LiskToken.s.sol @@ -20,11 +20,14 @@ contract L1LiskTokenScript is Script { // Deployer's private key. Owner of the L1 Lisk token. PRIVATE_KEY is set in .env file. uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + // Address, the ownership of L1 Lisk token contract is transferred to after deployment. + address ownerAddress = vm.envAddress("OWNER_ADDRESS"); console2.log("Simulation: Deploying L1 Lisk token..."); // deploy L1LiskToken contract vm.startBroadcast(deployerPrivateKey); L1LiskToken l1LiskToken = new L1LiskToken(); + l1LiskToken.transferOwnership(ownerAddress); vm.stopBroadcast(); assert(address(l1LiskToken) != address(0)); @@ -33,8 +36,11 @@ contract L1LiskTokenScript is Script { assert(l1LiskToken.decimals() == 18); assert(l1LiskToken.totalSupply() == 300000000 * 10 ** 18); assert(l1LiskToken.balanceOf(vm.addr(deployerPrivateKey)) == 300000000 * 10 ** 18); - assert(l1LiskToken.hasRole(l1LiskToken.DEFAULT_ADMIN_ROLE(), vm.addr(deployerPrivateKey)) == true); + assert(l1LiskToken.hasRole(l1LiskToken.DEFAULT_ADMIN_ROLE(), vm.addr(deployerPrivateKey)) == false); assert(l1LiskToken.hasRole(l1LiskToken.BURNER_ROLE(), vm.addr(deployerPrivateKey)) == false); + assert(l1LiskToken.hasRole(l1LiskToken.DEFAULT_ADMIN_ROLE(), ownerAddress) == true); + assert(l1LiskToken.hasRole(l1LiskToken.BURNER_ROLE(), ownerAddress) == false); + assert(l1LiskToken.balanceOf(ownerAddress) == 0); console2.log("Simulation: L1 Lisk token successfully deployed!"); console2.log("Simulation: L1 Lisk token address: %s", address(l1LiskToken));