Skip to content

Commit

Permalink
feat: tests layout
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyonline committed Aug 21, 2024
1 parent 01fa7d4 commit d63a2d3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface IRocketPoolDepositPool {
function deposit() external payable;
}

contract DepositStETHToYnLSDe is BaseYnEigenScript {
contract DepositToYnLSDe is BaseYnEigenScript {

address public broadcaster;

Expand All @@ -32,7 +32,13 @@ contract DepositStETHToYnLSDe is BaseYnEigenScript {
return "YnLSDe";
}

function run() external {
function run() public {
address token = _getTokenAddress(vm.prompt("Token (`sfrxETH`, `wstETH`, `mETH` and `rETH` (holesky only))"));
uint256 path = vm.parseUint(vm.prompt("Path (`0` for deposit or `1` for send"));
run(path, token);
}

function run(uint256 path, address token) public {

ContractAddresses contractAddresses = new ContractAddresses();
chainAddresses = contractAddresses.getChainAddresses(block.chainid);
Expand All @@ -45,9 +51,6 @@ contract DepositStETHToYnLSDe is BaseYnEigenScript {
console.log("Current Block Number:", block.number);
console.log("Current Chain ID:", block.chainid);

address token = _getTokenAddress(vm.prompt("Token (`sfrxETH`, `wstETH`, `mETH` and `rETH` (holesky only))"));
uint256 path = vm.parseUint(vm.prompt("Path (`0` for deposit or `1` for send"));

vm.startBroadcast(deployerPrivateKey);

uint256 _amount = _getToken(token);
Expand All @@ -68,7 +71,7 @@ contract DepositStETHToYnLSDe is BaseYnEigenScript {
if (keccak256(abi.encodePacked(n)) == keccak256(abi.encodePacked("sfrxETH")) && block.chainid == 1) {
return chainAddresses.lsd.SFRXETH_ADDRESS;
} else if (keccak256(abi.encodePacked(n)) == keccak256(abi.encodePacked("wstETH"))) {
return chainAddresses.lsd.STETH_ADDRESS;
return chainAddresses.lsd.WSTETH_ADDRESS;
} else if (keccak256(abi.encodePacked(n)) == keccak256(abi.encodePacked("mETH"))) {
return chainAddresses.lsd.METH_ADDRESS;
} else if (keccak256(abi.encodePacked(n)) == keccak256(abi.encodePacked("rETH")) && block.chainid == 17000) {
Expand All @@ -81,7 +84,7 @@ contract DepositStETHToYnLSDe is BaseYnEigenScript {
function _getToken(address token) internal returns (uint256 _amount) {
if (token == chainAddresses.lsd.SFRXETH_ADDRESS) {
_amount = _getSFRXETH();
} else if (token == chainAddresses.lsd.STETH_ADDRESS) {
} else if (token == chainAddresses.lsd.WSTETH_ADDRESS) {
_amount = _getWSTETH();
} else if (token == chainAddresses.lsd.METH_ADDRESS) {
_amount = _getMETH();
Expand All @@ -94,10 +97,7 @@ contract DepositStETHToYnLSDe is BaseYnEigenScript {

// NOTE: not deployed on holesky
function _getSFRXETH() internal returns (uint256) {
IfrxMinter(0xbAFA44EFE7901E04E39Dad13167D089C559c1138).submitAndDeposit{value: AMOUNT}(broadcaster);
IERC4626 frxeth = IERC4626(0x5E8422345238F34275888049021821E8E08CAa1f);
frxeth.approve(chainAddresses.lsd.SFRXETH_ADDRESS, AMOUNT);
return IERC4626(chainAddresses.lsd.SFRXETH_ADDRESS).deposit(AMOUNT, broadcaster);
return IfrxMinter(0xbAFA44EFE7901E04E39Dad13167D089C559c1138).submitAndDeposit{value: AMOUNT}(broadcaster);
}

function _getWSTETH() internal returns (uint256) {
Expand Down
21 changes: 21 additions & 0 deletions test/integration/ynEIGEN/DepositToYnLSDeScript.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: BSD 3-Clause License
pragma solidity ^0.8.24;

import "../../../script/commands/DepositToYnLSDe.s.sol";

import "forge-std/Test.sol";
import "forge-std/console.sol";

contract DepositToYnLSDeScript is DepositToYnLSDe, Test {

function testSfrxETHDeposit() public {
// return;
run();
}

// function testSfrxETHSend()
// function testMETHDeposit
// function testMETHSend
// function testRETHDeposit
// function testRETHSend
}

0 comments on commit d63a2d3

Please sign in to comment.