Skip to content

Commit

Permalink
Finish Base RYUSD deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
otsalex committed Nov 12, 2024
1 parent 8cfb297 commit 66e9d39
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ yarn-debug.log*
yarn-error.log*

.DS_Store

cellar-contracts/.idea
.idea
6 changes: 3 additions & 3 deletions script/Base/peggyjv_production/DeployDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
35 changes: 18 additions & 17 deletions script/Base/peggyjv_production/DeployTestCellar.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 {
Expand All @@ -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);
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions script/Base/peggyjv_production/SetUpArchitecture.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/resources/Base/BaseAddressesPeggyJV.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 66e9d39

Please sign in to comment.