From 66e9d3945ca0cc6a85bdd4821040a63671f2eb7f Mon Sep 17 00:00:00 2001 From: otsalex Date: Tue, 12 Nov 2024 13:04:57 +0200 Subject: [PATCH] Finish Base RYUSD deploy scripts --- .gitignore | 3 ++ .../peggyjv_production/DeployDeployer.s.sol | 6 ++-- .../peggyjv_production/DeployTestCellar.s.sol | 35 ++++++++++--------- .../SetUpArchitecture.s.sol | 6 ++-- test/resources/Base/BaseAddressesPeggyJV.sol | 2 +- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 5c315306..c8170b5b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ yarn-debug.log* yarn-error.log* .DS_Store + +cellar-contracts/.idea +.idea \ No newline at end of file diff --git a/script/Base/peggyjv_production/DeployDeployer.s.sol b/script/Base/peggyjv_production/DeployDeployer.s.sol index 627e2ee4..3802f985 100644 --- a/script/Base/peggyjv_production/DeployDeployer.s.sol +++ b/script/Base/peggyjv_production/DeployDeployer.s.sol @@ -3,17 +3,17 @@ pragma solidity 0.8.21; import { Deployer } from "src/Deployer.sol"; -import { BaseAddressesPeggyJV } from "test/resources/Base/BaseAddressesPeggyJV.sol"; +import { BaseAddresses } from "test/resources/Base/BaseAddressesPeggyJV.sol"; import "forge-std/Script.sol"; /** * @dev Run - * source .env && forge script script/Base/peggyjv_production/DeployDeployer.s.sol:DeployDeployerScript --rpc-url $BASE_RPC_URL --with-gas-price 100000000 --broadcast --private-key $DEV0_PRIVATE_KEY —optimize —optimizer-runs 200 + * source .env && forge script script/Base/peggyjv_production/DeployDeployer.s.sol:DeployDeployerScript --evm-version london --rpc-url $BASE_RPC_URL --with-gas-price 100000000 --broadcast --private-key $PRIVATE_KEY —optimize —optimizer-runs 200 * @dev Optionally can change `--with-gas-price` to something more reasonable */ -contract DeployDeployerScript is Script, BaseAddressesPeggyJV { +contract DeployDeployerScript is Script, BaseAddresses { function run() external { address[] memory deployers = new address[](2); diff --git a/script/Base/peggyjv_production/DeployTestCellar.s.sol b/script/Base/peggyjv_production/DeployTestCellar.s.sol index 770cc264..ef963949 100644 --- a/script/Base/peggyjv_production/DeployTestCellar.s.sol +++ b/script/Base/peggyjv_production/DeployTestCellar.s.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.21; import { Deployer } from "src/Deployer.sol"; import { Registry } from "src/Registry.sol"; import { PriceRouter } from "src/modules/price-router/PriceRouter.sol"; -import { BaseAddresses} from "test/resources/Base/BaseAddressesPeggyJV.sol"; +import { BaseAddresses } from "test/resources/Base/BaseAddressesPeggyJV.sol"; import { ContractDeploymentNames } from "resources/PeggyJVContractDeploymentNames.sol"; import { SafeTransferLib } from "@solmate/utils/SafeTransferLib.sol"; import { ERC20 } from "@solmate/tokens/ERC20.sol"; @@ -19,9 +19,7 @@ import "forge-std/Script.sol"; import "forge-std/StdJson.sol"; /** - * source .env && forge script script/Base/peggyjv_production/DeployTestCellar.s.sol:DeployCellarScript --evm-version london --with-gas-price 100000000 --slow --broadcast - * If you need to verify contracts after deployment run the following command - * source .env && forge script script/Base/peggyjv_production/DeployTestCellar.s.sol:DeployCellarScript --evm-version london --etherscan-api-key $BASESCAN_KEY --verify --resume --rpc-url $BASE_RPC_URL --private-key $DEV0_PRIVATE_KEY + * source .env && forge script script/Base/peggyjv_production/DeployTestCellar.s.sol:DeployCellarScript --evm-version london --with-gas-price 100000000 --slow --broadcast --rpc-url $BASE_RPC_URL --private-key $PRIVATE_KEY * @dev Optionally can change `--with-gas-price` to something more reasonable */ contract DeployCellarScript is Script, BaseAddresses, ContractDeploymentNames, PositionIds { @@ -46,8 +44,8 @@ contract DeployCellarScript is Script, BaseAddresses, ContractDeploymentNames, P CellarWithOracleWithBalancerFlashLoansWithMultiAssetDeposit public RYUSD; function setUp() external { - privateKey = vm.envUint("DEV0_PRIVATE_KEY"); - vm.createSelectFork("base"); + privateKey = vm.envUint("PRIVATE_KEY"); + registry = Registry(deployer.getAddress(registryName)); priceRouter = PriceRouter(deployer.getAddress(priceRouterName)); erc20Adaptor = deployer.getAddress(erc20AdaptorName); @@ -78,7 +76,7 @@ contract DeployCellarScript is Script, BaseAddresses, ContractDeploymentNames, P vm.startBroadcast(privateKey); // Deploy cellar. - RYUSD = _createCellarNoNativeSupport( + RYUSD = _createCellar( realYieldUsdName, "Real Yield USD", "RYUSD", @@ -108,28 +106,31 @@ contract DeployCellarScript is Script, BaseAddresses, ContractDeploymentNames, P RYUSD.addPositionToCatalogue(UNISWAP_V3_USDC_DAI_POSITION); RYUSD.addPositionToCatalogue(UNISWAP_V3_USDC_USDT_POSITION); RYUSD.addPositionToCatalogue(UNISWAP_V3_DAI_USDT_POSITION); - // Create Share Price Oracle. args._target = RYUSD; ERC4626SharePriceOracle oracle = _createSharePriceOracle(realYieldUsdSharePriceOracleName, args); + // Register cellar and oracle + registry.register(address(RYUSD)); + registry.register(address(oracle)); + + // Set the oracle for cellar. + RYUSD.setSharePriceOracle(4, oracle); // Initialize oracle. - uint96 initialUpkeepFunds = 0.26367e18; + uint96 initialUpkeepFunds = 0.1e18; LINK.safeApprove(address(oracle), initialUpkeepFunds); + oracle.initialize(initialUpkeepFunds); - // Set the oracle for cellar. - RYUSD.setSharePriceOracle(4, oracle); - console.log(address(RYUSD)); vm.stopBroadcast(); } - function _createSharePriceOracle( - string memory _name, - ERC4626SharePriceOracle.ConstructorArgs memory args - ) internal returns (ERC4626SharePriceOracle) { + function _createSharePriceOracle(string memory _name, ERC4626SharePriceOracle.ConstructorArgs memory args) + internal + returns (ERC4626SharePriceOracle) + { bytes memory creationCode; bytes memory constructorArgs; creationCode = type(ERC4626SharePriceOracle).creationCode; @@ -138,7 +139,7 @@ contract DeployCellarScript is Script, BaseAddresses, ContractDeploymentNames, P return ERC4626SharePriceOracle(deployer.deployContract(_name, creationCode, constructorArgs, 0)); } - function _createCellarNoNativeSupport( + function _createCellar( string memory deploymentName, string memory cellarName, string memory cellarSymbol, diff --git a/script/Base/peggyjv_production/SetUpArchitecture.s.sol b/script/Base/peggyjv_production/SetUpArchitecture.s.sol index 341406ea..91ccbfe6 100644 --- a/script/Base/peggyjv_production/SetUpArchitecture.s.sol +++ b/script/Base/peggyjv_production/SetUpArchitecture.s.sol @@ -26,7 +26,7 @@ import "forge-std/Script.sol"; import "forge-std/StdJson.sol"; /** - * source .env && forge script script/Base/peggyjv_production/SetUpArchitecture.s.sol:SetUpArchitectureScript --rpc-url $BASE_RPC_URL --with-gas-price 100000000 --slow --broadcast + * source .env && forge script script/Base/peggyjv_production/SetUpArchitecture.s.sol:SetUpArchitectureScript --rpc-url $BASE_RPC_URL --with-gas-price 100000000 --slow --broadcast --evm-version london --private-key $PRIVATE_KEY —optimize —optimizer-runs 200 * @dev Optionally can change `--with-gas-price` to something more reasonable */ contract SetUpArchitectureScript is Script, BaseAddresses, ContractDeploymentNames, PositionIds { @@ -53,13 +53,13 @@ contract SetUpArchitectureScript is Script, BaseAddresses, ContractDeploymentNam uint8 public constant EXTENSION_DERIVATIVE = 3; function setUp() external { - privateKey = vm.envUint("DEV0_PRIVATE_KEY"); + privateKey = vm.envUint("PRIVATE_KEY"); } function run() external { bytes memory creationCode; bytes memory constructorArgs; - vm.createSelectFork("base"); + vm.startBroadcast(privateKey); // Deploy Registry creationCode = type(Registry).creationCode; diff --git a/test/resources/Base/BaseAddressesPeggyJV.sol b/test/resources/Base/BaseAddressesPeggyJV.sol index 6d0b54d3..5f5b23da 100644 --- a/test/resources/Base/BaseAddressesPeggyJV.sol +++ b/test/resources/Base/BaseAddressesPeggyJV.sol @@ -16,7 +16,7 @@ contract BaseAddresses { // address public dev1Address = 0x6d3655EE04820f4385a910FD1898d4Ec6241F520; // address public cosmos = address(0xCAAA); // address public multisig = address(0); - address public deployerAddress = 0x58e75944B2B544B8F54C1e6f79eB464b98f0299b; + address public deployerAddress = 0x9fE006deb3D7de177968aEF714dbF96a98FE67F4; // address public priceRouter = address(0); // DeFi Ecosystem