From aae5535e535bb59747beaa3309a674c6e647734a Mon Sep 17 00:00:00 2001 From: Yuri Tkachenko Date: Mon, 30 Sep 2024 13:39:25 +0100 Subject: [PATCH] chore: remove duplicate --- contracts/0.8.9/SepoliaDepositAdapter.sol | 104 ---------------------- 1 file changed, 104 deletions(-) delete mode 100644 contracts/0.8.9/SepoliaDepositAdapter.sol diff --git a/contracts/0.8.9/SepoliaDepositAdapter.sol b/contracts/0.8.9/SepoliaDepositAdapter.sol deleted file mode 100644 index 48e5fa863..000000000 --- a/contracts/0.8.9/SepoliaDepositAdapter.sol +++ /dev/null @@ -1,104 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Lido -// SPDX-License-Identifier: GPL-3.0 - -/* See contracts/COMPILERS.md */ -pragma solidity 0.8.9; - -import "@openzeppelin/contracts-v4.4/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts-v4.4/access/Ownable.sol"; - -interface IDepositContract { - event DepositEvent( - bytes pubkey, - bytes withdrawal_credentials, - bytes amount, - bytes signature, - bytes index - ); - - function deposit( - bytes calldata pubkey, - bytes calldata withdrawal_credentials, - bytes calldata signature, - bytes32 deposit_data_root - ) external payable; - - function get_deposit_root() external view returns (bytes32); - - function get_deposit_count() external view returns (bytes memory); -} - -// Sepolia deposit contract variant of the source code https://github.com/protolambda/testnet-dep-contract/blob/master/deposit_contract.sol -interface ISepoliaDepositContract is IDepositContract, IERC20 { } - -// Sepolia testnet deposit contract have a bit different logic than the mainnet deposit contract. -// The differences are: -// 1. Sepolia contract require specific Bepolia token to be used for depositing. It burns this token after depositing. -// 2. It returns the ETH to the sender after depositing. -// This adapter is used to make the mainnet deposit contract compatible with the testnet deposit contract. -// For further information see Sepolia deposit contract variant source code link above. -contract SepoliaDepositAdapter is IDepositContract, Ownable { - - event EthReceived(address sender, uint256 amount); - - event EthRecovered(uint256 amount); - - event BepoliaRecovered(uint256 amount); - - error EthRecoverFailed(); - - error BepoliaRecoverFailed(); - - error DepositFailed(); - - ISepoliaDepositContract public immutable originalContract; - - constructor(address _deposit_contract) { - originalContract = ISepoliaDepositContract(_deposit_contract); - } - - function get_deposit_root() override external view returns (bytes32) { - return originalContract.get_deposit_root(); - } - - function get_deposit_count() override external view returns (bytes memory) { - return originalContract.get_deposit_count(); - } - - receive() external payable { - emit EthReceived(msg.sender, msg.value); - } - - function recoverEth() external onlyOwner { - uint256 balance = address(this).balance; - // solhint-disable-next-line avoid-low-level-calls - (bool success,) = owner().call{value: balance}(""); - if (!success) { - revert EthRecoverFailed(); - } - emit EthRecovered(balance); - } - - function recoverBepolia() external onlyOwner { - uint256 bepoliaOwnTokens = originalContract.balanceOf(address(this)); - bool success = originalContract.transfer(owner(), bepoliaOwnTokens); - if (!success) { - revert BepoliaRecoverFailed(); - } - emit BepoliaRecovered(bepoliaOwnTokens); - } - - function deposit( - bytes calldata pubkey, - bytes calldata withdrawal_credentials, - bytes calldata signature, - bytes32 deposit_data_root - ) override external payable { - originalContract.deposit{value: msg.value}(pubkey, withdrawal_credentials, signature, deposit_data_root); - // solhint-disable-next-line avoid-low-level-calls - (bool success,) = owner().call{value: msg.value}(""); - if (!success) { - revert DepositFailed(); - } - } -}