Skip to content

Commit

Permalink
fix: assets on diff networks
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyonline committed Dec 4, 2024
1 parent 7c4de0b commit ec1c596
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 26 deletions.
55 changes: 36 additions & 19 deletions script/ynEigen/DeployWithdrawalsProcessor.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import {WithdrawalsProcessor} from "src/ynEIGEN/WithdrawalsProcessor.sol";

import {YnEigenDeployer} from "./YnEigenDeployer.s.sol";

import {console} from "lib/forge-std/src/console.sol";

// ---- Usage ----

// deploy:
// forge script script/DeployWithdrawalsProcessor.s.sol:DeployWithdrawalsProcessor --verify --slow --legacy --etherscan-api-key $KEY --rpc-url $RPC_URL --broadcast
// forge script script/ynEigen/DeployWithdrawalsProcessor.s.sol:DeployWithdrawalsProcessor --verify --slow --legacy --etherscan-api-key $KEY --rpc-url $RPC_URL --broadcast

contract DeployWithdrawalsProcessor is YnEigenDeployer {

Expand All @@ -38,16 +40,21 @@ contract DeployWithdrawalsProcessor is YnEigenDeployer {
}

// deploy withdrawalsProcessor
WithdrawalsProcessor withdrawalsProcessor;
{
WithdrawalsProcessor withdrawalsProcessor = new WithdrawalsProcessor(
withdrawalsProcessor = new WithdrawalsProcessor(
chainAddresses.ynEigen.WITHDRAWAL_QUEUE_MANAGER_ADDRESS, // address(withdrawalQueueManager)
chainAddresses.ynEigen.TOKEN_STAKING_NODES_MANAGER_ADDRESS, // address(tokenStakingNodesManager)
chainAddresses.ynEigen.ASSET_REGISTRY_ADDRESS, // address(assetRegistry)
chainAddresses.ynEigen.EIGEN_STRATEGY_MANAGER_ADDRESS, // address(eigenStrategyManager)
chainAddresses.eigenlayer.DELEGATION_MANAGER_ADDRESS, // address(delegationManager)
chainAddresses.ynEigen.YNEIGEN_ADDRESS, // address(yneigen)
chainAddresses.ynEigen.REDEMPTION_ASSETS_VAULT_ADDRESS, // address(redemptionAssetsVault)
chainAddresses.ynEigen.WRAPPER // address(wrapper)
chainAddresses.ynEigen.WRAPPER, // address(wrapper)
chainAddresses.lsd.STETH_ADDRESS,
chainAddresses.lsd.WSTETH_ADDRESS,
chainAddresses.lsd.OETH_ADDRESS,
chainAddresses.lsd.WOETH_ADDRESS
);

withdrawalsProcessor = WithdrawalsProcessor(
Expand All @@ -61,21 +68,27 @@ contract DeployWithdrawalsProcessor is YnEigenDeployer {
WithdrawalsProcessor(address(withdrawalsProcessor)).initialize(owner, keeper);
}

// @todo - queue manually?
// // grant roles to withdrawalsProcessor
// {
// vm.startPrank(actors.wallets.YNSecurityCouncil);
// eigenStrategyManager.grantRole(
// eigenStrategyManager.STAKING_NODES_WITHDRAWER_ROLE(), address(withdrawalsProcessor)
// );
// eigenStrategyManager.grantRole(
// eigenStrategyManager.WITHDRAWAL_MANAGER_ROLE(), address(withdrawalsProcessor)
// );
// withdrawalQueueManager.grantRole(
// withdrawalQueueManager.REQUEST_FINALIZER_ROLE(), address(withdrawalsProcessor)
// );
// vm.stopPrank();
// }
// grant roles to withdrawalsProcessor
{
// vm.startPrank(actors.wallets.YNSecurityCouncil);
// eigenStrategyManager.grantRole(
// eigenStrategyManager.STAKING_NODES_WITHDRAWER_ROLE(), address(withdrawalsProcessor)
// );
// eigenStrategyManager.grantRole(
// eigenStrategyManager.WITHDRAWAL_MANAGER_ROLE(), address(withdrawalsProcessor)
// );
// withdrawalQueueManager.grantRole(
// withdrawalQueueManager.REQUEST_FINALIZER_ROLE(), address(withdrawalsProcessor)
// );
// vm.stopPrank();
console.log("----------------------------------");
console.log("Grant roles to WithdrawalsProcessor:");
console.log("YNSecurityCouncil: ", actors.wallets.YNSecurityCouncil);
console.log("WithdrawalsProcessor: ", address(withdrawalsProcessor));
console.log("EigenStrategyManager: ", chainAddresses.ynEigen.EIGEN_STRATEGY_MANAGER_ADDRESS);
console.log("withdrawalQueueManager: ", chainAddresses.ynEigen.WITHDRAWAL_QUEUE_MANAGER_ADDRESS);
console.log("----------------------------------");
}
}

function _isOngoingWithdrawals() private returns (bool) {
Expand All @@ -90,7 +103,11 @@ contract DeployWithdrawalsProcessor is YnEigenDeployer {
_assets[i]
)
) > 0
) return true;
) {
console.log("Ongoing withdrawals - asset: ", address(_assets[i]));
console.log("Ongoing withdrawals - node: ", address(_nodes[j]));
return true;
}
}
}
return false;
Expand Down
19 changes: 14 additions & 5 deletions src/ynEIGEN/WithdrawalsProcessor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ contract WithdrawalsProcessor is IWithdrawalsProcessor, Initializable, AccessCon
IDelegationManager public immutable delegationManager;

// assets
IERC20 private constant STETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
IwstETH private constant WSTETH = IwstETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);
IERC4626 private constant WOETH = IERC4626(0xDcEe70654261AF21C44c093C300eD3Bb97b78192);
IERC20 private constant OETH = IERC20(0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3);
IERC20 private immutable STETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
IwstETH private immutable WSTETH = IwstETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);
IERC20 private immutable OETH = IERC20(0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3);
IERC4626 private immutable WOETH = IERC4626(0xDcEe70654261AF21C44c093C300eD3Bb97b78192);

// used to prevent rounding errors
uint256 private constant MIN_DELTA = 1000;
Expand All @@ -68,7 +68,11 @@ contract WithdrawalsProcessor is IWithdrawalsProcessor, Initializable, AccessCon
address _delegationManager,
address _yneigen,
address _redemptionAssetsVault,
address _wrapper
address _wrapper,
address _steth,
address _wsteth,
address _oeth,
address _woeth
) {
if (
_withdrawalQueueManager == address(0) || _tokenStakingNodesManager == address(0)
Expand All @@ -84,6 +88,11 @@ contract WithdrawalsProcessor is IWithdrawalsProcessor, Initializable, AccessCon
yneigen = IynEigen(_yneigen);
redemptionAssetsVault = IRedemptionAssetsVault(_redemptionAssetsVault);
wrapper = IWrapper(_wrapper);

STETH = IERC20(_steth);
WSTETH = IwstETH(_wsteth);
OETH = IERC20(_oeth);
WOETH = IERC4626(_woeth);
}

function initialize(address _owner, address _keeper) public initializer {
Expand Down
6 changes: 5 additions & 1 deletion test/integration/ynEIGEN/WithdrawalsProcessor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ contract WithdrawalsProcessorTest is ynEigenIntegrationBaseTest {
address(eigenLayer.delegationManager),
address(ynEigenToken),
address(redemptionAssetsVault),
address(wrapper)
address(wrapper),
chainAddresses.lsd.STETH_ADDRESS,
chainAddresses.lsd.WSTETH_ADDRESS,
chainAddresses.lsd.OETH_ADDRESS,
chainAddresses.lsd.WOETH_ADDRESS
);

withdrawalsProcessor = WithdrawalsProcessor(address(new TransparentUpgradeableProxy(address(withdrawalsProcessor), actors.admin.PROXY_ADMIN_OWNER, "")));
Expand Down
6 changes: 5 additions & 1 deletion test/scenarios/ynEIGEN/WithdrawalsProcessor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ contract WithdrawalsProcessorForkTest is ynLSDeScenarioBaseTest {
address(delegationManager),
address(yneigen),
address(redemptionAssetsVault),
address(wrapper)
address(wrapper),
chainAddresses.lsd.STETH_ADDRESS,
chainAddresses.lsd.WSTETH_ADDRESS,
chainAddresses.lsd.OETH_ADDRESS,
chainAddresses.lsd.WOETH_ADDRESS
);

withdrawalsProcessor = WithdrawalsProcessor(
Expand Down

0 comments on commit ec1c596

Please sign in to comment.