From 3287503327d1b51ddc084ff0fa3eb3ab648c669a Mon Sep 17 00:00:00 2001 From: ReposCollector Date: Sat, 6 Dec 2025 08:57:29 +0900 Subject: [PATCH] wip --- script/VerifyV3Upgrade.s.sol | 7 +- script/deploys/Deployed.s.sol | 1 + src/BNFT.sol | 1 + src/LiquidityPool.sol | 20 +- src/NodeOperatorManager.sol | 7 +- src/TNFT.sol | 2 +- src/interfaces/IBNFT.sol | 1 + src/interfaces/IEtherFiNodesManager.sol | 4 +- src/interfaces/ILiquidityPool.sol | 5 +- src/interfaces/IStakingManager.sol | 8 +- src/interfaces/ITNFT.sol | 1 + test/BNFT.t.sol | 124 ---------- test/EETH.t.sol | 4 +- test/LiquidityPool.t.sol | 314 +----------------------- test/TNFT.t.sol | 74 ------ test/TestSetup.sol | 75 ++---- test/WeETH.t.sol | 4 +- test/behaviour-tests/prelude.t.sol | 4 - 18 files changed, 65 insertions(+), 591 deletions(-) delete mode 100644 test/BNFT.t.sol delete mode 100644 test/TNFT.t.sol diff --git a/script/VerifyV3Upgrade.s.sol b/script/VerifyV3Upgrade.s.sol index 38059e17..ee4ed38a 100644 --- a/script/VerifyV3Upgrade.s.sol +++ b/script/VerifyV3Upgrade.s.sol @@ -11,7 +11,6 @@ import "../src/interfaces/IEtherFiOracle.sol"; import "../src/interfaces/IEtherFiAdmin.sol"; import "../src/interfaces/IeETH.sol"; import "../src/interfaces/IWeETH.sol"; -import "../src/interfaces/ITNFT.sol"; import "../src/StakingManager.sol"; import "../src/EtherFiNodesManager.sol"; import "../src/EtherFiNode.sol"; @@ -46,7 +45,6 @@ contract VerifyV3Upgrade is Script { address etherFiAdmin = 0x0EF8fa4760Db8f5Cd4d993f3e3416f30f942D705; address eETH = 0x35fA164735182de50811E8e2E824cFb9B6118ac2; address weETH = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee; - address TNFT = 0x7B5ae07E2AF1C861BcC4736D23f5f66A61E0cA5e; // ERC1967 storage slot for implementation address bytes32 constant IMPLEMENTATION_SLOT = @@ -86,7 +84,7 @@ contract VerifyV3Upgrade is Script { console2.log("----------------------------------------"); verifyContractInteractions(); - // 5. Verify Additional Contracts (Oracle, Admin, eETH, weETH, TNFT) + // 5. Verify Additional Contracts (Oracle, Admin, eETH, weETH) console2.log("\n5. VERIFYING ADDITIONAL CONTRACTS"); console2.log("----------------------------------------"); verifyAdditionalContracts(); @@ -387,9 +385,6 @@ contract VerifyV3Upgrade is Script { console2.log("Checking weETH..."); verifyProxyUpgradeability(weETH, "weETH"); - // Verify TNFT upgradeability - console2.log("Checking TNFT..."); - verifyProxyUpgradeability(TNFT, "TNFT"); // Additional specific checks for these contracts console2.log("\nChecking EtherFiOracle specific functionality..."); diff --git a/script/deploys/Deployed.s.sol b/script/deploys/Deployed.s.sol index 5ff27c11..0668f198 100644 --- a/script/deploys/Deployed.s.sol +++ b/script/deploys/Deployed.s.sol @@ -16,6 +16,7 @@ contract Deployed { // Membership & NFTs address public constant MEMBERSHIP_MANAGER = 0x3d320286E014C3e1ce99Af6d6B00f0C1D63E3000; address public constant MEMBERSHIP_NFT = 0xb49e4420eA6e35F98060Cd133842DbeA9c27e479; + // Deprecated legacy NFT contracts retained for historical reference only. address public constant TNFT = 0x7B5ae07E2AF1C861BcC4736D23f5f66A61E0cA5e; address public constant BNFT = 0x6599861e55abd28b91dd9d86A826eC0cC8D72c2c; address public constant WITHDRAW_REQUEST_NFT = 0x7d5706f6ef3F89B3951E23e557CDFBC3239D4E2c; diff --git a/src/BNFT.sol b/src/BNFT.sol index b0910b65..e3737327 100644 --- a/src/BNFT.sol +++ b/src/BNFT.sol @@ -5,6 +5,7 @@ import "@openzeppelin-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin-upgradeable/contracts/access/OwnableUpgradeable.sol"; +// Deprecated legacy bNFT contract retained for historical storage compatibility. Do not use in new flows. contract BNFT is ERC721Upgradeable, UUPSUpgradeable, OwnableUpgradeable { //-------------------------------------------------------------------------------------- //--------------------------------- STATE-VARIABLES ---------------------------------- diff --git a/src/LiquidityPool.sol b/src/LiquidityPool.sol index 98380da3..d61c01ce 100644 --- a/src/LiquidityPool.sol +++ b/src/LiquidityPool.sol @@ -19,6 +19,11 @@ import "./interfaces/IRoleRegistry.sol"; contract LiquidityPool is Initializable, OwnableUpgradeable, UUPSUpgradeable, ILiquidityPool { using SafeERC20 for IERC20; + + // Deprecated legacy holder struct kept to maintain storage layout. + struct BnftHolder { + address holder; + } //-------------------------------------------------------------------------------------- //--------------------------------- STATE-VARIABLES ---------------------------------- //-------------------------------------------------------------------------------------- @@ -124,8 +129,8 @@ contract LiquidityPool is Initializable, OwnableUpgradeable, UUPSUpgradeable, IL totalValueInLp += uint128(msg.value); } - function initialize(address _eEthAddress, address _stakingManagerAddress, address _nodesManagerAddress, address _membershipManagerAddress, address _tNftAddress, address _etherFiAdminContract, address _withdrawRequestNFT) external initializer { - if (_eEthAddress == address(0) || _stakingManagerAddress == address(0) || _nodesManagerAddress == address(0) || _membershipManagerAddress == address(0) || _tNftAddress == address(0)) revert DataNotSet(); + function initialize(address _eEthAddress, address _stakingManagerAddress, address _nodesManagerAddress, address _membershipManagerAddress, address _etherFiAdminContract, address _withdrawRequestNFT) external initializer { + if (_eEthAddress == address(0) || _stakingManagerAddress == address(0) || _nodesManagerAddress == address(0) || _membershipManagerAddress == address(0)) revert DataNotSet(); __Ownable_init(); __UUPSUpgradeable_init(); @@ -133,7 +138,6 @@ contract LiquidityPool is Initializable, OwnableUpgradeable, UUPSUpgradeable, IL stakingManager = IStakingManager(_stakingManagerAddress); nodesManager = IEtherFiNodesManager(_nodesManagerAddress); membershipManager = _membershipManagerAddress; - DEPRECATED_TNFT = _tNftAddress; paused = true; restakeBnftDeposits = false; ethAmountLockedForWithdrawal = 0; @@ -373,7 +377,7 @@ contract LiquidityPool is Initializable, OwnableUpgradeable, UUPSUpgradeable, IL validatorSizeWei = _validatorSizeWei; } - /// @notice The admin can register an address to become a BNFT holder + /// @notice The admin can register an address to become a validator spawner (legacy bNFT role) /// @param _user The address of the Validator Spawner to register function registerValidatorSpawner(address _user) public { if (!roleRegistry.hasRole(LIQUIDITY_POOL_ADMIN_ROLE, msg.sender)) revert IncorrectRole(); @@ -384,6 +388,12 @@ contract LiquidityPool is Initializable, OwnableUpgradeable, UUPSUpgradeable, IL emit ValidatorSpawnerRegistered(_user); } + /// @notice Backwards-compatible alias for legacy bNFT flow. + /// @dev Calls `registerValidatorSpawner` under the hood to preserve role checks and events. + function registerAsBnftHolder(address _user) external { + registerValidatorSpawner(_user); + } + /// @notice Removes a Validator Spawner /// @param _user the address of the Validator Spawner to remove function unregisterValidatorSpawner(address _user) external { @@ -412,7 +422,7 @@ contract LiquidityPool is Initializable, OwnableUpgradeable, UUPSUpgradeable, IL emit Rebase(getTotalPooledEther(), eETH.totalShares()); } - /// @notice pay protocol fees including 5% to treaury, 5% to node operator and ethfund bnft holders + /// @notice pay protocol fees including treasury and node operator splits (legacy bnft logic removed) /// @param _protocolFees The amount of protocol fees to pay in ether function payProtocolFees(uint128 _protocolFees) external { if (msg.sender != address(etherFiAdminContract)) revert IncorrectCaller(); diff --git a/src/NodeOperatorManager.sol b/src/NodeOperatorManager.sol index b91162bb..ab4fd1a7 100644 --- a/src/NodeOperatorManager.sol +++ b/src/NodeOperatorManager.sol @@ -127,10 +127,9 @@ contract NodeOperatorManager is INodeOperatorManager, Initializable, UUPSUpgrade } /// @notice Approves or un approves an operator to run validators from a specific source of funds - /// @dev To allow a permissioned system, we will approve node operators to run validators only for a specific source of funds (EETH / ETHER_FAN) - /// Some operators can be approved for both sources and some for only one. Being approved means that when a BNFT player deposits, - /// we allocate a source of funds to be used for the deposit. And only operators approved for that source can run the validators - /// being created. + /// @dev To allow a permissioned system, we will approve node operators to run validators only for a specific source of funds (EETH / ETHER_FAN). + /// Some operators can be approved for both sources and some for only one. + /// Legacy bNFT references have been removed; approvals now apply generically to validator spawners. /// @param _users the operator addresses to perform an approval or denial on /// @param _approvedTags the source of funds we will be updating operator permissions for /// @param _approvals whether we are approving or un approving the operator diff --git a/src/TNFT.sol b/src/TNFT.sol index e5214e76..5a4875f7 100644 --- a/src/TNFT.sol +++ b/src/TNFT.sol @@ -7,7 +7,7 @@ import "@openzeppelin-upgradeable/contracts/access/OwnableUpgradeable.sol"; import "./interfaces/IEtherFiNodesManager.sol"; - +// Deprecated legacy tNFT contract retained for historical storage compatibility. Do not use in new flows. contract TNFT is ERC721Upgradeable, UUPSUpgradeable, OwnableUpgradeable { //-------------------------------------------------------------------------------------- //--------------------------------- STATE-VARIABLES ---------------------------------- diff --git a/src/interfaces/IBNFT.sol b/src/interfaces/IBNFT.sol index 496ce908..bd3e4b4c 100644 --- a/src/interfaces/IBNFT.sol +++ b/src/interfaces/IBNFT.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.13; import "@openzeppelin-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol"; +// Deprecated: legacy bNFT interface retained for storage/ABI compatibility only. interface IBNFT is IERC721Upgradeable { function burnFromWithdrawal(uint256 _validatorId) external; diff --git a/src/interfaces/IEtherFiNodesManager.sol b/src/interfaces/IEtherFiNodesManager.sol index 1ac85bf1..293fe8db 100644 --- a/src/interfaces/IEtherFiNodesManager.sol +++ b/src/interfaces/IEtherFiNodesManager.sol @@ -81,9 +81,9 @@ interface IEtherFiNodesManager { |-------------------------------------------+---------------------------------------------------------------+------+--------+-------+-------------------------------------------------| | etherfiNodeAddress | mapping(uint256 => address) | 305 | 0 | 32 | src/EtherFiNodesManager.sol:EtherFiNodesManager | |-------------------------------------------+---------------------------------------------------------------+------+--------+-------+-------------------------------------------------| - | tnft | contract TNFT | 306 | 0 | 20 | src/EtherFiNodesManager.sol:EtherFiNodesManager | + | DEPRECATED_tnft | address | 306 | 0 | 20 | src/EtherFiNodesManager.sol:EtherFiNodesManager | |-------------------------------------------+---------------------------------------------------------------+------+--------+-------+-------------------------------------------------| - | bnft | contract BNFT | 307 | 0 | 20 | src/EtherFiNodesManager.sol:EtherFiNodesManager | + | DEPRECATED_bnft | address | 307 | 0 | 20 | src/EtherFiNodesManager.sol:EtherFiNodesManager | |-------------------------------------------+---------------------------------------------------------------+------+--------+-------+-------------------------------------------------| | auctionManager | contract IAuctionManager | 308 | 0 | 20 | src/EtherFiNodesManager.sol:EtherFiNodesManager | |-------------------------------------------+---------------------------------------------------------------+------+--------+-------+-------------------------------------------------| diff --git a/src/interfaces/ILiquidityPool.sol b/src/interfaces/ILiquidityPool.sol index 23374139..4574f518 100644 --- a/src/interfaces/ILiquidityPool.sol +++ b/src/interfaces/ILiquidityPool.sol @@ -33,10 +33,6 @@ interface ILiquidityPool { uint32 startOfSlotNumOwners; } - struct BnftHolder { - address holder; - } - struct ValidatorSpawner { bool registered; } @@ -68,6 +64,7 @@ interface ILiquidityPool { function DEPRECATED_sendExitRequests(uint256[] calldata _validatorIds) external; function registerValidatorSpawner(address _user) external; + function registerAsBnftHolder(address _user) external; function unregisterValidatorSpawner(address _user) external; function rebase(int128 _accruedRewards) external; diff --git a/src/interfaces/IStakingManager.sol b/src/interfaces/IStakingManager.sol index 8989618b..87294a12 100644 --- a/src/interfaces/IStakingManager.sol +++ b/src/interfaces/IStakingManager.sol @@ -43,9 +43,9 @@ interface IStakingManager { |------------------------+-------------------------------------------------------+------+--------+-------+---------------------------------------| | merkleRoot | bytes32 | 304 | 0 | 32 | src/StakingManager.sol:StakingManager | |------------------------+-------------------------------------------------------+------+--------+-------+---------------------------------------| - | TNFTInterfaceInstance | contract ITNFT | 305 | 0 | 20 | src/StakingManager.sol:StakingManager | + | DEPRECATED_TNFTInterfaceInstance | address | 305 | 0 | 20 | src/StakingManager.sol:StakingManager | |------------------------+-------------------------------------------------------+------+--------+-------+---------------------------------------| - | BNFTInterfaceInstance | contract IBNFT | 306 | 0 | 20 | src/StakingManager.sol:StakingManager | + | DEPRECATED_BNFTInterfaceInstance | address | 306 | 0 | 20 | src/StakingManager.sol:StakingManager | |------------------------+-------------------------------------------------------+------+--------+-------+---------------------------------------| | auctionManager | contract IAuctionManager | 307 | 0 | 20 | src/StakingManager.sol:StakingManager | |------------------------+-------------------------------------------------------+------+--------+-------+---------------------------------------| @@ -71,12 +71,12 @@ interface IStakingManager { //--------------------------------------------------------------------------- event validatorCreated(bytes32 indexed pubkeyHash, address indexed etherFiNode, bytes pubkey); - event validatorConfirmed(bytes32 indexed pubkeyHash, address indexed bnftRecipient, address indexed tnftRecipient, bytes pubkey); + event validatorConfirmed(bytes32 indexed pubkeyHash, address indexed validatorRecipient, address indexed withdrawalRecipient, bytes pubkey); event linkLegacyValidatorId(bytes32 indexed pubkeyHash, uint256 indexed legacyId); event EtherFiNodeDeployed(address indexed etheFiNode); // legacy event still being emitted in its original form to play nice with existing external tooling - event ValidatorRegistered(address indexed operator, address indexed bNftOwner, address indexed tNftOwner, uint256 validatorId, bytes validatorPubKey, string ipfsHashForEncryptedValidatorKey); + event ValidatorRegistered(address indexed operator, address indexed validatorRecipient, address indexed withdrawalRightsRecipient, uint256 validatorId, bytes validatorPubKey, string ipfsHashForEncryptedValidatorKey); //-------------------------------------------------------------------------- //----------------------------- Errors ----------------------------------- diff --git a/src/interfaces/ITNFT.sol b/src/interfaces/ITNFT.sol index 8fd057fa..e31b9f27 100644 --- a/src/interfaces/ITNFT.sol +++ b/src/interfaces/ITNFT.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.13; import "@openzeppelin-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol"; +// Deprecated: legacy tNFT interface retained for storage/ABI compatibility only. interface ITNFT is IERC721Upgradeable { function burnFromWithdrawal(uint256 _validatorId) external; diff --git a/test/BNFT.t.sol b/test/BNFT.t.sol deleted file mode 100644 index 80b51fa8..00000000 --- a/test/BNFT.t.sol +++ /dev/null @@ -1,124 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import "./TestSetup.sol"; - -contract BNFTTest is TestSetup { - function setUp() public { - setUpTests(); - } - - function test_DisableInitializer() public { - vm.expectRevert("Initializable: contract is already initialized"); - vm.prank(owner); - BNFTImplementation.initialize(address(stakingManagerInstance)); - } - - /* - function test_Mint() public { - startHoax(0xCd5EBC2dD4Cb3dc52ac66CEEcc72c838B40A5931); - nodeOperatorManagerInstance.registerNodeOperator( - _ipfsHash, - 5 - ); - uint256[] memory bidIds = auctionInstance.createBid{value: 1 ether}( - 1, - 1 ether - ); - vm.stopPrank(); - - hoax(alice); - stakingManagerInstance.batchDepositWithBidIds{value: 32 ether}( - bidIds, - false - ); - - IStakingManager.DepositData[] - memory depositDataArray = new IStakingManager.DepositData[](1); - - address etherFiNode = managerInstance.etherFiNodeFromId(1); - bytes32 root = generateDepositRoot( - hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - managerInstance.addressToWithdrawalCredentials(etherFiNode), - 32 ether - ); - - IStakingManager.DepositData memory depositData = IStakingManager - .DepositData({ - publicKey: hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - signature: hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - depositDataRoot: root, - ipfsHashForEncryptedValidatorKey: "test_ipfs" - }); - - depositDataArray[0] = depositData; - - - startHoax(alice); - stakingManagerInstance.batchRegisterValidators(zeroRoot, bidIds, depositDataArray); - vm.stopPrank(); - - assertEq(BNFTInstance.ownerOf(1), alice); - assertEq(BNFTInstance.balanceOf(alice), 1); - } - */ - - function test_BNFTMintsFailsIfNotCorrectCaller() public { - vm.startPrank(alice); - vm.expectRevert("Only staking manager contract"); - BNFTInstance.mint(address(alice), 1); - } - - /* - function test_BNFTCannotBeTransferred() public { - vm.prank(0xCd5EBC2dD4Cb3dc52ac66CEEcc72c838B40A5931); - nodeOperatorManagerInstance.registerNodeOperator( - _ipfsHash, - 5 - ); - - startHoax(0xCd5EBC2dD4Cb3dc52ac66CEEcc72c838B40A5931); - - auctionInstance.createBid{value: 0.1 ether}(1, 0.1 ether); - - uint256[] memory bidIdArray = new uint256[](1); - bidIdArray[0] = 1; - - stakingManagerInstance.batchDepositWithBidIds{value: 32 ether}( - bidIdArray, - false - ); - - IStakingManager.DepositData[] - memory depositDataArray = new IStakingManager.DepositData[](1); - - address etherFiNode = managerInstance.etherFiNodeFromId(1); - bytes32 root = generateDepositRoot( - hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - managerInstance.addressToWithdrawalCredentials(etherFiNode), - 32 ether - ); - - IStakingManager.DepositData memory depositData = IStakingManager - .DepositData({ - publicKey: hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - signature: hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - depositDataRoot: root, - ipfsHashForEncryptedValidatorKey: "test_ipfs" - }); - - depositDataArray[0] = depositData; - - stakingManagerInstance.batchRegisterValidators(zeroRoot, bidIdArray, depositDataArray); - - vm.expectRevert("Err: token is SOUL BOUND"); - BNFTInstance.transferFrom( - 0xCd5EBC2dD4Cb3dc52ac66CEEcc72c838B40A5931, - address(alice), - 1 - ); - } - */ -} diff --git a/test/EETH.t.sol b/test/EETH.t.sol index 8163de8f..600225dc 100644 --- a/test/EETH.t.sol +++ b/test/EETH.t.sol @@ -362,7 +362,7 @@ contract EETHTest is TestSetup { function test_RecoverERC721() public { // Create a mock ERC721 token - TestERC721 mockNFT = new TestERC721("Test NFT", "TNFT"); + TestERC721 mockNFT = new TestERC721("Test NFT", "TEST"); // Mint NFT to alice and send to eETH contract uint256 tokenId = mockNFT.mint(alice); @@ -438,7 +438,7 @@ contract EETHTest is TestSetup { } function test_RecoverERC721_ErrorConditions() public { - TestERC721 mockNFT = new TestERC721("Test NFT", "TNFT"); + TestERC721 mockNFT = new TestERC721("Test NFT", "TEST"); uint256 tokenId = mockNFT.mint(alice); // Send NFT to eETH contract diff --git a/test/LiquidityPool.t.sol b/test/LiquidityPool.t.sol index 3cf7d745..b7826b50 100644 --- a/test/LiquidityPool.t.sol +++ b/test/LiquidityPool.t.sol @@ -292,91 +292,9 @@ contract LiquidityPoolTest is TestSetup { assertEq(liquidityPoolInstance.getTotalPooledEther(), 103 ether); } - function test_RegisterAsBnftHolder() public { - //Move past one week - vm.warp(804650); - - vm.expectRevert(LiquidityPool.IncorrectRole.selector); - liquidityPoolInstance.registerValidatorSpawner(alice); - - //Let Alice sign up as a BNFT holder - vm.startPrank(alice); - registerAsBnftHolder(alice); - vm.stopPrank(); - bool registered= liquidityPoolInstance.validatorSpawner(alice); - assertEq(registered, true); - } - // TODO(Dave): update for new deposit flow - /* - function test_DepositAsBnftHolderSimple() public { - - //Sets up the list of BNFT holders - setUpBnftHolders(); - - IEtherFiOracle.OracleReport memory report = _emptyOracleReport(); - - _initReportBlockStamp(report); - _executeAdminTasks(report); - - //Move to a random time in the future - _moveClock(100000); - - vm.startPrank(alice); - - //Alice deposits funds into the LP to allow for validators to be spun and the calculations can work in dutyForWeek - liquidityPoolInstance.deposit{value: 120 ether}(); - - vm.stopPrank(); - - vm.prank(elvis); - //Making sure if a user is assigned they send in the correct amount (This will be updated - //as we will allow users to specify how many validator they want to spin up) - vm.expectRevert("Not enough balance"); - liquidityPoolInstance.batchDeposit(bidIds, 4); - - //Move way more in the future - _moveClock(100000); - - - //This triggers the number of active holders to be updated to include the previous bnft holders - //However, Chad will not be included in this weeks duty - vm.startPrank(alice); - registerAsBnftHolder(chad); - vm.stopPrank(); - - vm.prank(alice); - //Alice deposits funds into the LP to allow for validators to be spun and the calculations can work in dutyForWeek - liquidityPoolInstance.deposit{value: 300 ether}(); - - IEtherFiOracle.OracleReport memory report2 = _emptyOracleReport(); - - _initReportBlockStamp(report2); - _executeAdminTasks(report2); - - - vm.prank(shonee); - //Shonee deposits and her index is 4, allowing her to deposit for 4 validators - validators = liquidityPoolInstance.batchDeposit(bidIds, 4); - assertEq(validators[0], 1); - assertEq(validators[1], 2); - assertEq(validators[2], 3); - assertEq(validators[3], 4); - assertEq(liquidityPoolInstance.numPendingDeposits(), 4); - - vm.prank(dan); - - //Dan deposits and his index is 5, allowing him to deposit - validators = liquidityPoolInstance.batchDeposit(bidIds, 2); - assertEq(liquidityPoolInstance.numPendingDeposits(), 6); - - assertEq(validators[0], 5); - assertEq(validators[1], 6); - } - */ - // function test_.unregisterValidatorSpawner() public { - // setUpBnftHolders(); + // setUpValidatorSpawners(); // (address ownerIndexAddress, ) = liquidityPoolInstance.bnftHolders(3); // (address henryIndexAddress, ) = liquidityPoolInstance.bnftHolders(7); @@ -404,7 +322,7 @@ contract LiquidityPoolTest is TestSetup { // } function test_unregisterValidatorSpawnerIfIncorrectCaller() public { - setUpBnftHolders(); + setUpValidatorSpawners(); vm.prank(bob); vm.expectRevert("Incorrect Caller"); @@ -419,8 +337,8 @@ contract LiquidityPoolTest is TestSetup { IEtherFiOracle.OracleReport memory report = _emptyOracleReport(); _executeAdminTasks(report); - //Sets up the list of BNFT holders - setUpBnftHolders(); + //Sets up the list of validator spawners + setUpValidatorSpawners(); vm.startPrank(alice); @@ -450,190 +368,6 @@ contract LiquidityPoolTest is TestSetup { } */ - /* - function test_DepositFromBNFTHolder() public { - - IEtherFiOracle.OracleReport memory report = _emptyOracleReport(); - _executeAdminTasks(report); - - vm.startPrank(alice); - registerAsBnftHolder(alice); - registerAsBnftHolder(greg); - - vm.deal(alice, 100000 ether); - vm.deal(greg, 100000 ether); - - //Alice deposits funds into the LP to allow for validators to be spun and the calculations can work in dutyForWeek - liquidityPoolInstance.deposit{value: 128 ether}(); - vm.stopPrank(); - - //Move forward in time to make sure dutyForWeek runs with an arbitrary timestamp - vm.warp(12431561615); - startHoax(alice); - bidIds = auctionInstance.createBid{value: 1 ether}( - 10, - 0.1 ether - ); - vm.stopPrank(); - - startHoax(alice); - processedBids = liquidityPoolInstance.batchDeposit(bidIds, 4); - - assertEq(stakingManagerInstance.bidIdToStaker(11), alice); - assertEq(stakingManagerInstance.bidIdToStaker(12), alice); - assertEq(stakingManagerInstance.bidIdToStaker(13), alice); - assertEq(stakingManagerInstance.bidIdToStaker(14), alice); - } - */ - - /* - function test_RestakedDepositFromBNFTHolder() public { - initializeRealisticFork(MAINNET_FORK); - _initBid(); - - vm.expectRevert(LiquidityPool.IncorrectRole.selector); - liquidityPoolInstance.setRestakeBnftDeposits(true); - - vm.deal(alice, 1000 ether); - vm.startPrank(alice); - - uint256[] memory bidIds; - uint256[] memory validatorIds; - - registerAsBnftHolder(alice); - bidIds = auctionInstance.createBid{value: 0.1 ether}(1, 0.1 ether); - - liquidityPoolInstance.setRestakeBnftDeposits(true); - - liquidityPoolInstance.deposit{value: 120 ether}(); - bidIds = auctionInstance.createBid{value: 1 ether}( - 10, - 0.1 ether - ); - - address bnftHolder = alice; - startHoax(bnftHolder); - processedBids = liquidityPoolInstance.batchDeposit(bidIds, 4); - - assertEq(stakingManagerInstance.bidIdToStaker(bidIds[0]), bnftHolder); - assertEq(stakingManagerInstance.bidIdToStaker(bidIds[1]), bnftHolder); - assertEq(stakingManagerInstance.bidIdToStaker(bidIds[2]), bnftHolder); - assertEq(stakingManagerInstance.bidIdToStaker(bidIds[3]), bnftHolder); - - // verify that created nodes have associated eigenPods - IEtherFiNode node = IEtherFiNode(managerInstance.etherFiNodeFromId(bidIds[0])); - assertFalse(address(node.getEigenPod()) == address(0x0)); - node = IEtherFiNode(managerInstance.etherFiNodeFromId(bidIds[1])); - assertFalse(address(node.getEigenPod()) == address(0x0)); - node = IEtherFiNode(managerInstance.etherFiNodeFromId(bidIds[2])); - assertFalse(address(node.getEigenPod()) == address(0x0)); - node = IEtherFiNode(managerInstance.etherFiNodeFromId(bidIds[3])); - assertFalse(address(node.getEigenPod()) == address(0x0)); - } - */ - - /* - function test_RegisterAsBNFTHolder() public { - - test_DepositFromBNFTHolder(); - - assertEq(processedBids[0], 11); - assertEq(processedBids[1], 12); - assertEq(processedBids[2], 13); - assertEq(processedBids[3], 14); - - IStakingManager.DepositData[] - memory depositDataArray = new IStakingManager.DepositData[](1); - - bytes32[] memory depositDataRootsForApproval = new bytes32[](1); - - address etherFiNode = managerInstance.etherFiNodeFromId(11); - root = generateDepositRoot( - hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - managerInstance.addressToWithdrawalCredentials(etherFiNode), - 1 ether - ); - - depositDataRootsForApproval[0] = generateDepositRoot( - hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - managerInstance.addressToWithdrawalCredentials(etherFiNode), - 31 ether - ); - - IStakingManager.DepositData memory depositData = IStakingManager - .DepositData({ - publicKey: hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - signature: hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - depositDataRoot: root, - ipfsHashForEncryptedValidatorKey: "test_ipfs" - }); - - depositDataArray[0] = depositData; - - validatorArray = new uint256[](1); - validatorArray[0] = processedBids[0]; - - assertEq(BNFTInstance.balanceOf(alice), 0); - assertEq(TNFTInstance.balanceOf(address(liquidityPoolInstance)), 0); - - bytes[] memory pubKey = new bytes[](1); - pubKey[0] = hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c"; - - bytes[] memory sig = new bytes[](1); - sig[0] = hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df"; - - liquidityPoolInstance.batchRegister(_getDepositRoot(), validatorArray, depositDataArray, depositDataRootsForApproval, sig); - - assertEq(liquidityPoolInstance.numPendingDeposits(), 3); - assertEq(BNFTInstance.balanceOf(address(liquidityPoolInstance)), 1); - assertEq(TNFTInstance.balanceOf(address(liquidityPoolInstance)), 1); - } - */ - - /* - function test_DepositFromBNFTHolderTwice() public { - - IEtherFiOracle.OracleReport memory report = _emptyOracleReport(); - _executeAdminTasks(report); - - vm.startPrank(alice); - registerAsBnftHolder(alice); - registerAsBnftHolder(greg); - - vm.deal(alice, 100000 ether); - vm.deal(greg, 100000 ether); - - //Alice deposits funds into the LP to allow for validators to be spun and the calculations can work in dutyForWeek - liquidityPoolInstance.deposit{value: 240 ether}(); - vm.stopPrank(); - - //Move forward in time to make sure dutyForWeek runs with an arbitrary timestamp - vm.warp(12431561615); - - startHoax(alice); - bidIds = auctionInstance.createBid{value: 1 ether}( - 10, - 0.1 ether - ); - vm.stopPrank(); - - startHoax(alice); - processedBids = liquidityPoolInstance.batchDeposit(bidIds, 4); - - assertEq(stakingManagerInstance.bidIdToStaker(11), alice); - assertEq(stakingManagerInstance.bidIdToStaker(12), alice); - assertEq(stakingManagerInstance.bidIdToStaker(13), alice); - assertEq(stakingManagerInstance.bidIdToStaker(14), alice); - - assertEq(stakingManagerInstance.bidIdToStaker(15), address(0)); - assertEq(stakingManagerInstance.bidIdToStaker(16), address(0)); - assertEq(stakingManagerInstance.bidIdToStaker(17), address(0)); - assertEq(stakingManagerInstance.bidIdToStaker(18), address(0)); - } - */ - /* function test_goerli_test() internal { initializeRealisticFork(TESTNET_FORK); @@ -670,42 +404,6 @@ contract LiquidityPoolTest is TestSetup { */ - - // TODO(dave): update when v3 changes finalized - - /* - function test_any_bnft_staker() public { - _moveClock(1 days); - - vm.deal(alice, 1000 ether); - vm.deal(bob, 1000 ether); - - vm.startPrank(alice); - registerAsBnftHolder(alice); - registerAsBnftHolder(address(liquidityPoolInstance)); - uint256[] memory bidIds = auctionInstance.createBid{value: 0.1 ether}(1, 0.1 ether); - liquidityPoolInstance.deposit{value: 124 ether}(); - vm.stopPrank(); - - vm.startPrank(bob); - vm.expectRevert("Incorrect Caller"); - liquidityPoolInstance.batchDeposit(bidIds, 1); - vm.stopPrank(); - - - vm.startPrank(alice); - liquidityPoolInstance.batchDeposit(bidIds, 1); - vm.stopPrank(); - - vm.prank(bob); - vm.expectRevert("INCORRECT_CALLER"); - liquidityPoolInstance.batchCancelDeposit(bidIds); - - vm.prank(alice); - liquidityPoolInstance.batchCancelDeposit(bidIds); - } - */ - function test_deopsitToRecipient_by_rando_fails() public { vm.startPrank(alice); vm.expectRevert("Incorrect Caller"); @@ -715,7 +413,7 @@ contract LiquidityPoolTest is TestSetup { /* function test_Zellic_PoC() public { - setUpBnftHolders(); + setUpValidatorSpawners(); vm.deal(alice, 1000 ether); vm.deal(henry, 1000 ether); @@ -1082,7 +780,7 @@ contract LiquidityPoolTest is TestSetup { function test_UnregisterValidatorSpawner() public { vm.startPrank(alice); - registerAsBnftHolder(bob); + registerValidatorSpawnerForTest(bob); assertTrue(liquidityPoolInstance.validatorSpawner(bob)); liquidityPoolInstance.unregisterValidatorSpawner(bob); diff --git a/test/TNFT.t.sol b/test/TNFT.t.sol deleted file mode 100644 index 5aab94c2..00000000 --- a/test/TNFT.t.sol +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import "./TestSetup.sol"; - -contract TnftTest is TestSetup { - - function setUp() public { - setUpTests(); - - assertEq(TNFTInstance.stakingManagerAddress(), address(stakingManagerInstance)); - } - - function test_DisableInitializer() public { - vm.expectRevert("Initializable: contract is already initialized"); - vm.prank(owner); - BNFTImplementation.initialize(address(stakingManagerInstance)); - } - - function test_TNFTMintsFailsIfNotCorrectCaller() public { - vm.startPrank(alice); - vm.expectRevert("Only staking manager contract"); - TNFTInstance.mint(address(alice), 1); - } - - /* - function test_Mint() public { - startHoax(0xCd5EBC2dD4Cb3dc52ac66CEEcc72c838B40A5931); - nodeOperatorManagerInstance.registerNodeOperator( - _ipfsHash, - 5 - ); - uint256[] memory bidIds = auctionInstance.createBid{value: 1 ether}( - 1, - 1 ether - ); - vm.stopPrank(); - - hoax(alice); - stakingManagerInstance.batchDepositWithBidIds{value: 32 ether}( - bidIds, - false - ); - - address etherFiNode = managerInstance.etherFiNodeFromId(1); - bytes32 root = generateDepositRoot( - hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - managerInstance.addressToWithdrawalCredentials(etherFiNode), - 32 ether - ); - - IStakingManager.DepositData[] - memory depositDataArray = new IStakingManager.DepositData[](1); - - IStakingManager.DepositData memory depositData = IStakingManager - .DepositData({ - publicKey: hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c", - signature: hex"877bee8d83cac8bf46c89ce50215da0b5e370d282bb6c8599aabdbc780c33833687df5e1f5b5c2de8a6cd20b6572c8b0130b1744310a998e1079e3286ff03e18e4f94de8cdebecf3aaac3277b742adb8b0eea074e619c20d13a1dda6cba6e3df", - depositDataRoot: root, - ipfsHashForEncryptedValidatorKey: "test_ipfs" - }); - - depositDataArray[0] = depositData; - - startHoax(alice); - stakingManagerInstance.batchRegisterValidators(zeroRoot, bidIds, depositDataArray); - vm.stopPrank(); - - assertEq(TNFTInstance.ownerOf(1), alice); - assertEq(TNFTInstance.balanceOf(alice), 1); - } - */ -} diff --git a/test/TestSetup.sol b/test/TestSetup.sol index e1f33d73..a0b19139 100644 --- a/test/TestSetup.sol +++ b/test/TestSetup.sol @@ -23,8 +23,6 @@ import "../src/NodeOperatorManager.sol"; import "../src/archive/RegulationsManager.sol"; import "../src/AuctionManager.sol"; import "../src/archive/ProtocolRevenueManager.sol"; -import "../src/BNFT.sol"; -import "../src/TNFT.sol"; import "../src/EtherFiNode.sol"; import "../src/EtherFiRateLimiter.sol"; import "../src/LiquidityPool.sol"; @@ -103,8 +101,6 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { UUPSProxy public etherFiNodeManagerProxy; UUPSProxy public rateLimiterProxy; UUPSProxy public protocolRevenueManagerProxy; - UUPSProxy public TNFTProxy; - UUPSProxy public BNFTProxy; UUPSProxy public liquidityPoolProxy; UUPSProxy public liquifierProxy; UUPSProxy public etherFiRestakerProxy; @@ -149,11 +145,6 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { RoleRegistry public roleRegistryImplementation; RoleRegistry public roleRegistryInstance; - TNFT public TNFTImplementation; - TNFT public TNFTInstance; - - BNFT public BNFTImplementation; - BNFT public BNFTInstance; LiquidityPool public liquidityPoolImplementation; LiquidityPool public liquidityPoolInstance; @@ -243,7 +234,6 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { address superAdmin; address[] public actors; - address[] public bnftHoldersArray; uint256[] public whitelistIndices; bytes aliceIPFSHash = "AliceIPFS"; @@ -405,8 +395,6 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { membershipNftInstance = MembershipNFT(addressProviderInstance.getContractAddress("MembershipNFT")); auctionInstance = AuctionManager(addressProviderInstance.getContractAddress("AuctionManager")); stakingManagerInstance = StakingManager(addressProviderInstance.getContractAddress("StakingManager")); - TNFTInstance = TNFT(addressProviderInstance.getContractAddress("TNFT")); - BNFTInstance = BNFT(addressProviderInstance.getContractAddress("BNFT")); nodeOperatorManagerInstance = NodeOperatorManager(addressProviderInstance.getContractAddress("NodeOperatorManager")); node = EtherFiNode(payable(addressProviderInstance.getContractAddress("EtherFiNode"))); earlyAdopterPoolInstance = EarlyAdopterPool(payable(addressProviderInstance.getContractAddress("EarlyAdopterPool"))); @@ -534,16 +522,6 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { //stakingManagerInstance.initialize(address(auctionInstance), address(mockDepositContractEth2)); //stakingManagerInstance.updateAdmin(alice, true); - TNFTImplementation = new TNFT(); - TNFTProxy = new UUPSProxy(address(TNFTImplementation), ""); - TNFTInstance = TNFT(address(TNFTProxy)); - TNFTInstance.initialize(address(stakingManagerInstance)); - - BNFTImplementation = new BNFT(); - BNFTProxy = new UUPSProxy(address(BNFTImplementation), ""); - BNFTInstance = BNFT(address(BNFTProxy)); - BNFTInstance.initialize(address(stakingManagerInstance)); - protocolRevenueManagerImplementation = new ProtocolRevenueManager(); protocolRevenueManagerProxy = new UUPSProxy(address(protocolRevenueManagerImplementation), ""); protocolRevenueManagerInstance = ProtocolRevenueManager(payable(address(protocolRevenueManagerProxy))); @@ -555,9 +533,6 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { managerInstance = EtherFiNodesManager(payable(address(etherFiNodeManagerProxy))); - TNFTInstance.initializeOnUpgrade(address(managerInstance)); - BNFTInstance.initializeOnUpgrade(address(managerInstance)); - regulationsManagerImplementation = new RegulationsManager(); vm.expectRevert("Initializable: contract is already initialized"); regulationsManagerImplementation.initialize(); @@ -707,7 +682,7 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { roleRegistryInstance.grantRole(keccak256("ETHERFI_REDEMPTION_MANAGER_ADMIN_ROLE"), owner); etherFiRedemptionManagerInstance.initializeTokenParameters(_tokens, _exitFeeSplitToTreasuryInBps, _exitFeeInBps, _lowWatermarkInBpsOfTvl, _bucketCapacity, _bucketRefillRate); - liquidityPoolInstance.initialize(address(eETHInstance), address(stakingManagerInstance), address(etherFiNodeManagerProxy), address(membershipManagerInstance), address(TNFTInstance), address(etherFiAdminProxy), address(withdrawRequestNFTInstance)); + liquidityPoolInstance.initialize(address(eETHInstance), address(stakingManagerInstance), address(etherFiNodeManagerProxy), address(membershipManagerInstance), address(etherFiAdminProxy), address(withdrawRequestNFTInstance)); liquidityPoolInstance.initializeVTwoDotFourNine(address(roleRegistryInstance), address(etherFiRedemptionManagerInstance)); membershipNftInstance.initialize("https://etherfi-cdn/{id}.json", address(membershipManagerInstance)); @@ -739,8 +714,6 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { address(treasuryInstance), address(auctionInstance), address(stakingManagerInstance), - address(TNFTInstance), - address(BNFTInstance), address(eigenLayerEigenPodManager), address(eigenLayerDelayedWithdrawalRouter), address(eigenLayerDelegationManager) @@ -874,8 +847,8 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { //stakingManagerInstance.setEtherFiNodesManagerAddress(address(managerInstance)); //stakingManagerInstance.setLiquidityPoolAddress(address(liquidityPoolInstance)); //stakingManagerInstance.registerEtherFiNodeImplementationContract(address(node)); - //stakingManagerInstance.registerTNFTContract(address(TNFTInstance)); - //stakingManagerInstance.registerBNFTContract(address(BNFTInstance)); + //stakingManagerInstance.registerTNFTContract(address(0)); + //stakingManagerInstance.registerBNFTContract(address(0)); vm.stopPrank(); @@ -1249,7 +1222,7 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { return permitInput; } - function registerAsBnftHolder(address _user) internal { + function registerValidatorSpawnerForTest(address _user) internal { bool registered = liquidityPoolInstance.validatorSpawner(_user); vm.expectEmit(true, true, false, true); @@ -1257,17 +1230,17 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { if (!registered) liquidityPoolInstance.registerValidatorSpawner(_user); } - function setUpBnftHolders() internal { + function setUpValidatorSpawners() internal { vm.startPrank(alice); - registerAsBnftHolder(alice); - registerAsBnftHolder(greg); - registerAsBnftHolder(bob); - registerAsBnftHolder(owner); - registerAsBnftHolder(shonee); - registerAsBnftHolder(dan); - registerAsBnftHolder(elvis); - registerAsBnftHolder(henry); - registerAsBnftHolder(address(liquidityPoolInstance)); + registerValidatorSpawnerForTest(alice); + registerValidatorSpawnerForTest(greg); + registerValidatorSpawnerForTest(bob); + registerValidatorSpawnerForTest(owner); + registerValidatorSpawnerForTest(shonee); + registerValidatorSpawnerForTest(dan); + registerValidatorSpawnerForTest(elvis); + registerValidatorSpawnerForTest(henry); + registerValidatorSpawnerForTest(address(liquidityPoolInstance)); vm.stopPrank(); vm.deal(alice, 100000 ether); @@ -1332,21 +1305,21 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { return launch_validator(2, 0, false, alice); } - function launch_validator(uint256 _numValidators, uint256 _validatorIdToCoUseWithdrawalSafe, bool _isLpBnftHolder) internal returns (uint256[] memory) { - return launch_validator(_numValidators, _validatorIdToCoUseWithdrawalSafe, _isLpBnftHolder, alice, alice); + function launch_validator(uint256 _numValidators, uint256 _validatorIdToCoUseWithdrawalSafe, bool _restakeFlag) internal returns (uint256[] memory) { + return launch_validator(_numValidators, _validatorIdToCoUseWithdrawalSafe, _restakeFlag, alice, alice); } - function launch_validator(uint256 _numValidators, uint256 _validatorIdToCoUseWithdrawalSafe, bool _isLpBnftHolder, address _bnftStaker) internal returns (uint256[] memory) { - return launch_validator(_numValidators, _validatorIdToCoUseWithdrawalSafe, _isLpBnftHolder, _bnftStaker, alice); + function launch_validator(uint256 _numValidators, uint256 _validatorIdToCoUseWithdrawalSafe, bool _restakeFlag, address _staker) internal returns (uint256[] memory) { + return launch_validator(_numValidators, _validatorIdToCoUseWithdrawalSafe, _restakeFlag, _staker, alice); } - function launch_validator(uint256 _numValidators, uint256 _validatorIdToCoUseWithdrawalSafe, bool _isLpBnftHolder, address _bnftStaker, address _nodeOperator) internal returns (uint256[] memory) { + function launch_validator(uint256 _numValidators, uint256 _validatorIdToCoUseWithdrawalSafe, bool _restakeFlag, address _staker, address _nodeOperator) internal returns (uint256[] memory) { bytes32 rootForApproval; vm.deal(owner, 10000 ether); vm.deal(alice, 10000 ether); vm.deal(bob, 10000 ether); - vm.deal(_bnftStaker, 10000 ether); + vm.deal(_staker, 10000 ether); address admin; if (block.chainid == 1) { @@ -1357,7 +1330,7 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { admin = alice; } vm.startPrank(admin); - registerAsBnftHolder(_nodeOperator); + registerValidatorSpawnerForTest(_nodeOperator); // liquidityPoolInstance.updateBnftMode(_isLpBnftHolder); vm.stopPrank(); @@ -1393,7 +1366,7 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { vm.stopPrank(); startHoax(bob); - if (_isLpBnftHolder) { + if (_restakeFlag) { liquidityPoolInstance.deposit{value: 32 ether * _numValidators}(); } else { liquidityPoolInstance.deposit{value: 32 ether * _numValidators}(); @@ -1401,7 +1374,7 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { vm.stopPrank(); // TODO(dave): rework test setup - //vm.prank(_bnftStaker); + //vm.prank(_staker); //uint256[] memory newValidators = liquidityPoolInstance.batchDeposit(bidIds, _numValidators, _validatorIdToCoUseWithdrawalSafe); //uint256[] memory newValidators = new uint256[](_numValidators); uint256[] memory newValidators = bidIds; @@ -1444,7 +1417,7 @@ contract TestSetup is Test, ContractCodeChecker, DepositDataGeneration { pubKey[i] = hex"8f9c0aab19ee7586d3d470f132842396af606947a0589382483308fdffdaf544078c3be24210677a9c471ce70b3b4c2c"; } - vm.startPrank(_bnftStaker); + vm.startPrank(_staker); bytes32 depositRoot = zeroRoot; // TODO(Dave): fix for new deposit flow address fix_nodeAddress = address(0x1234AABB); diff --git a/test/WeETH.t.sol b/test/WeETH.t.sol index 0e977448..a9561a6e 100644 --- a/test/WeETH.t.sol +++ b/test/WeETH.t.sol @@ -362,7 +362,7 @@ contract WeETHTest is TestSetup { function test_RecoverERC721() public { // Create a mock ERC721 token - TestERC721 mockNFT = new TestERC721("Test NFT", "TNFT"); + TestERC721 mockNFT = new TestERC721("Test NFT", "TEST"); // Mint NFT to alice and send to eETH contract uint256 tokenId = mockNFT.mint(alice); @@ -438,7 +438,7 @@ contract WeETHTest is TestSetup { } function test_RecoverERC721_ErrorConditions() public { - TestERC721 mockNFT = new TestERC721("Test NFT", "TNFT"); + TestERC721 mockNFT = new TestERC721("Test NFT", "TEST"); uint256 tokenId = mockNFT.mint(alice); // Send NFT to eETH contract diff --git a/test/behaviour-tests/prelude.t.sol b/test/behaviour-tests/prelude.t.sol index 00518f77..ddd5fa0a 100644 --- a/test/behaviour-tests/prelude.t.sol +++ b/test/behaviour-tests/prelude.t.sol @@ -14,8 +14,6 @@ import "../../src/EtherFiNode.sol"; import "../../src/EtherFiRateLimiter.sol"; import "../../src/UUPSProxy.sol"; import "../../src/NodeOperatorManager.sol"; -import "../../src/interfaces/ITNFT.sol"; -import "../../src/interfaces/IBNFT.sol"; import "../../src/AuctionManager.sol"; import "../../src/libraries/DepositDataRootGenerator.sol"; @@ -27,8 +25,6 @@ contract PreludeTest is Test, ArrayTestHelper { EtherFiNodesManager etherFiNodesManager; AuctionManager auctionManager; EtherFiNode etherFiNodeImpl; - ITNFT tnft; - IBNFT bnft; NodeOperatorManager nodeOperatorManager = NodeOperatorManager(0xd5edf7730ABAd812247F6F54D7bd31a52554e35E); address admin = vm.addr(0x9876543210);