Skip to content

Commit

Permalink
Add in vesting tests and new timelock vesting deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
crispymangoes committed Oct 2, 2023
1 parent e9eb5df commit 26f1cf9
Show file tree
Hide file tree
Showing 6 changed files with 315 additions and 46 deletions.
44 changes: 44 additions & 0 deletions script/prod/CreateVestingTimelock.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.21;

import { TimelockController } from "@openzeppelin/contracts/governance/TimelockController.sol";
import { ERC20 } from "@solmate/tokens/ERC20.sol";

import "forge-std/Script.sol";

/**
* @dev Run
* `source .env && forge script script/prod/CreateVestingTimelock.s.sol:CreateVestingTimelockScript --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY —optimize —optimizer-runs 200 --with-gas-price 25000000000 --verify --etherscan-api-key $ETHERSCAN_KEY --slow --broadcast`
* @dev Optionally can change `--with-gas-price` to something more reasonable
*/
contract CreateVestingTimelockScript is Script {
// TimelockController private controller = TimelockController(payable(0xAa71f75fb6948a6c814A28675241FC5E3bCaC355));
address private somm = 0xa670d7237398238DE01267472C6f13e5B8010FD1;
address private dest = 0xA9962a5BfBea6918E958DeE0647E99fD7863b95A;
address private devOwner = 0x552acA1343A6383aF32ce1B7c7B1b47959F7ad90;

TimelockController private timelock;

function run() external {
uint256 minDelay = 2 * 365 days;
address[] memory proposers = new address[](2);
address[] memory executors = new address[](1);
address admin = dest;

proposers[0] = devOwner;
proposers[1] = dest;

executors[0] = dest;

bytes memory payload0 = abi.encodeWithSelector(ERC20.transfer.selector, dest, 400_000e6);
bytes memory payload1 = abi.encodeWithSelector(TimelockController.updateDelay.selector, 300);

vm.startBroadcast();
timelock = new TimelockController(minDelay, proposers, executors, admin);

timelock.schedule(somm, 0, payload0, hex"", hex"", 2 * 365 days);
timelock.schedule(address(timelock), 0, payload1, hex"", hex"", 2 * 365 days);

vm.stopBroadcast();
}
}
32 changes: 0 additions & 32 deletions script/prod/CreateVestingTimelockTXs.s.sol

This file was deleted.

4 changes: 2 additions & 2 deletions script/prod/DeployCellarWithShareLockPeriod.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract DeployCellarWithShareLockPeriodScript is Script, MainnetAddresses {
uint64 strategistPlatformCut = 0.75e18;
uint192 shareSupplyCap = type(uint192).max;

USDC.approve(deployer.getAddress(string.concat(name, " V0.0")), initialDeposit);
// USDC.approve(deployer.getAddress(string.concat(name, " V0.0")), initialDeposit);

CellarWithShareLockPeriod cellar = _createCellarWithShareLockPeriod(
owner,
Expand All @@ -48,7 +48,7 @@ contract DeployCellarWithShareLockPeriodScript is Script, MainnetAddresses {
shareSupplyCap
);

cellar.transferOwnership(strategist);
cellar.transferOwnership(testStrategist);

vm.stopBroadcast();
}
Expand Down
28 changes: 16 additions & 12 deletions script/prod/DeploySupportingContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { BalancerStablePoolExtension } from "src/modules/price-router/Extensions
import { MorphoAaveV2ATokenAdaptor } from "src/modules/adaptors/Morpho/MorphoAaveV2ATokenAdaptor.sol";
import { MorphoAaveV3ATokenP2PAdaptor } from "src/modules/adaptors/Morpho/MorphoAaveV3ATokenP2PAdaptor.sol";

import { DebtFTokenAdaptorV1 } from "src/modules/adaptors/Frax/DebtFTokenAdaptorV1.sol";

import { MainnetAddresses } from "test/resources/MainnetAddresses.sol";

import "forge-std/Script.sol";
Expand Down Expand Up @@ -54,31 +56,33 @@ contract DeploySupportingContractsScript is Script, MainnetAddresses {
MorphoAaveV2ATokenAdaptor public morphoAaveV2ATokenAdaptor;
MorphoAaveV3ATokenP2PAdaptor public morphoAaveV3ATokenP2PAdaptor;

DebtFTokenAdaptorV1 public debtFTokenAdaptorV1;

uint32 public morphoAaveV2AWeth = 5_000_001;
uint32 public morphoAaveV3AWeth = 5_000_002;

function run() external {
// bytes memory creationCode;
// bytes memory constructorArgs;
bytes memory creationCode;
bytes memory constructorArgs;

vm.startBroadcast();

registry.transferOwnership(multisig);
priceRouter.transferOwnership(multisig);
// registry.transferOwnership(multisig);
// priceRouter.transferOwnership(multisig);

// Deploy the price router.
// creationCode = type(PriceRouter).creationCode;
// constructorArgs = abi.encode(sommDev, registry, WETH);
// priceRouter = PriceRouter(deployer.deployContract("PriceRouter V0.0", creationCode, constructorArgs, 0));

// // Deploy WSTETH Extension.
// {
// creationCode = type(WstEthExtension).creationCode;
// constructorArgs = abi.encode(priceRouter);
// wstEthExtension = WstEthExtension(
// deployer.deployContract("wstETH Extension V0.0", creationCode, constructorArgs, 0)
// );
// }
// Deploy WSTETH Extension.
{
creationCode = type(DebtFTokenAdaptorV1).creationCode;
constructorArgs = abi.encode(true, FRAX, 1.05e18);
debtFTokenAdaptorV1 = DebtFTokenAdaptorV1(
deployer.deployContract("FraxLend debtTokenV1 Adaptor V 0.2", creationCode, constructorArgs, 0)
);
}

// Deploy Morpho Aave V2 AToken Adaptor.
// {
Expand Down
41 changes: 41 additions & 0 deletions script/prod/DeployVestingContracts.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.21;

import { PriceRouter } from "src/modules/price-router/PriceRouter.sol";
import { Deployer } from "src/Deployer.sol";
import { VestingSimple } from "src/modules/vesting/VestingSimple.sol";
import { VestingSimpleAdaptor } from "src/modules/adaptors/VestingSimpleAdaptor.sol";

import { MainnetAddresses } from "test/resources/MainnetAddresses.sol";

import "forge-std/Script.sol";

/**
* @dev Run
* `source .env && forge script script/prod/DeployVestingContracts.s.sol:DeployVestingContractsScript --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY —optimize —optimizer-runs 200 --with-gas-price 25000000000 --verify --etherscan-api-key $ETHERSCAN_KEY --slow --broadcast`
* @dev Optionally can change `--with-gas-price` to something more reasonable
*/
contract DeployVestingContractsScript is Script, MainnetAddresses {
Deployer public deployer = Deployer(deployerAddress);

function run() external {
bytes memory creationCode;
bytes memory constructorArgs;

vm.startBroadcast();

// Deploy Vesting Simple Adaptor
creationCode = type(VestingSimpleAdaptor).creationCode;
deployer.deployContract("VestingSimpleAdaptor V 1.0", creationCode, constructorArgs, 0);

// Deploy vesting contracts.
creationCode = type(VestingSimple).creationCode;
constructorArgs = abi.encode(GHO, 7 days, 0.01e18);
deployer.deployContract("VestingSimple GHO 7 days V0.0", creationCode, constructorArgs, 0);

creationCode = type(VestingSimple).creationCode;
constructorArgs = abi.encode(SWETH, 30 days, 0.01e18);
deployer.deployContract("VestingSimple SWETH 30 days V0.0", creationCode, constructorArgs, 0);
vm.stopBroadcast();
}
}
Loading

0 comments on commit 26f1cf9

Please sign in to comment.