Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy scripts and timelock tx params #175

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions script/deploys/DeployEtherFiRouter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "forge-std/Script.sol";

import "src/EtherFiRewardsRouter.sol";
import "src/UUPSProxy.sol";
import "../../src/helpers/AddressProvider.sol";
import "forge-std/console.sol";

/* Tenderly
* source .env && forge script ./script/deploys/DeployEtherFiRewardsRouter.s.sol:DeployEtherFiRewardsRouter --rpc-url $TENDERLY_RPC_URL --broadcast --etherscan-api-key $TENDERLY_ACCESS_CODE --verify --verifier-url $TENDERLY_VERIFIER_URL --slow -vvvv
*/

/* Tenderly
* source .env && forge script ./script/deploys/DeployEtherFiRewardsRouter.s.sol:DeployEtherFiRewardsRouter --rpc-url MAINNET_RPC_URL --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify --slow -vvvv
*/

contract DeployEtherFiRewardsRouter is Script {

AddressProvider public addressProvider;
///////////////////////////////////////
address roleRegistryProxyAddress = address(0x084C62123FccfC9fA7cbc3952cE9321259C0EcB9); //replace with deployed RoleRegistryProxy address
address treasuryGnosisSafeAddress = address(0x0c83EAe1FE72c390A02E426572854931EefF93BA);
address etherfiRouterAdmin = address(0xc351788DDb96cD98d99E62C97f57952A8b3Fc1B5);
//////////////////////////////////////

function run() external {

address addressProviderAddress = vm.envAddress("CONTRACT_REGISTRY");
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

vm.startBroadcast(deployerPrivateKey);

RoleRegistry roleRegistryInstance = RoleRegistry(roleRegistryProxyAddress);
roleRegistryInstance.grantRole(keccak256("ETHERFI_ROUTER_ADMIN"), etherfiRouterAdmin);

addressProvider = AddressProvider(addressProviderAddress);

address liquidityPoolProxyAddress = addressProvider.getContractAddress("LiquidityPool");
bytes memory initializerData = abi.encodeWithSelector(EtherFiRewardsRouter.initialize.selector);
EtherFiRewardsRouter etherFiRewardsRouterImplementation = new EtherFiRewardsRouter(liquidityPoolProxyAddress, roleRegistryProxyAddress, treasuryGnosisSafeAddress);
UUPSProxy etherFiRewardsRouterProxy = new UUPSProxy(address(etherFiRewardsRouterImplementation), initializerData);
}
vvalecha519 marked this conversation as resolved.
Show resolved Hide resolved
}
35 changes: 35 additions & 0 deletions script/deploys/DeployRoleRegistry.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;

import "forge-std/Script.sol";

import "src/RoleRegistry.sol";
import "src/UUPSProxy.sol";
import "../../src/helpers/AddressProvider.sol";

/* Tenderly
* source .env && forge script ./script/deploys/DeployRoleRegistry.s.sol:DeployRoleRegistry --rpc-url $TESTNET_RPC_URL --broadcast --etherscan-api-key $TESTNET_RPC_URL --verify --verifier-url $TENDERLY_VERIFIER_URL --slow -vvvv
*/

/* Tenderly
* source .env && forge script ./script/deploys/DeployRoleRegistry.s.sol:DeployRoleRegistry --rpc-url MAINNET_RPC_URL --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify --slow -vvvv
*/

contract DeployRoleRegistry is Script {

AddressProvider public addressProvider;
///////////////////////////////////////
address superAdmin = address(0xc351788DDb96cD98d99E62C97f57952A8b3Fc1B5); //replace with actual super admin address
//////////////////////////////////////

function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

RoleRegistry roleRegistryImplementation = new RoleRegistry();
bytes memory initializerData = abi.encodeWithSelector(RoleRegistry.initialize.selector, superAdmin);
UUPSProxy roleRegistryProxy = new UUPSProxy(address(roleRegistryImplementation), initializerData);
vvalecha519 marked this conversation as resolved.
Show resolved Hide resolved

vm.stopBroadcast();
}
}
39 changes: 39 additions & 0 deletions script/upgrades/TimelockScheduleCalldata.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "forge-std/Script.sol";
import "forge-std/console.sol";
import "src/helpers/AddressProvider.sol";

contract TimelockScheduleCalldata is Script {

////////////////Change this////////////
address newLiquidityPoolImplementation = address(0x02656fe285FAC5d5c756C2F03C17277Df9BAc65B);
address newEtherFiOracleImplementation = address(0x9B9608844275e186C92AAfF115e5025fca9f22F4);
address newEtherFiAdminImplementation = address(0x0C4a8Aa58885402dB92c2a0D3d748265ce3d63c4);
///////////////////////////////////////

AddressProvider addressProvider;

function run() external {
address addressProviderAddress = vm.envAddress("CONTRACT_REGISTRY");
addressProvider = AddressProvider(addressProviderAddress);

string [3] memory names = ["LiquidityPool", "EtherFiOracle", "EtherFiAdmin"];

for (uint i = 0; i < names.length; i++) {
address contractAddress = addressProvider.getContractAddress(names[i]);
console.log("Upgrade Timelock Params: ", names[i]);
console.log("Contract Address: ", contractAddress);
console.log("Value: ", 0);
console.log("Data:");
console.logBytes(abi.encodeWithSignature("upgradeTo(address)", newLiquidityPoolImplementation));
console.log("Predecessor:");
console.logBytes32(bytes32(0));
console.log("Salt:");
console.logBytes32(0x0);
console.log("Delay: ", 259200);
console.log("");
}
}
}
1 change: 0 additions & 1 deletion src/EtherFiRewardsRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ contract EtherFiRewardsRouter is OwnableUpgradeable, UUPSUpgradeable {
}

function withdrawToLiquidityPool() external {
if (!roleRegistry.hasRole(ETHERFI_ROUTER_ADMIN, msg.sender)) revert IncorrectRole();

uint256 balance = address(this).balance;
require(balance > 0, "Contract balance is zero");
Expand Down
Loading