Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): add withdraw eth function to proverset #17800

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/protocol/contracts/team/proving/ProverSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../common/EssentialContract.sol";
import "../../common/LibStrings.sol";
import "../../libs/LibAddress.sol";
import "../../L1/ITaikoL1.sol";

interface IHasRecipient {
Expand All @@ -29,6 +30,7 @@ contract ProverSet is EssentialContract, IERC1271 {

error INVALID_STATUS();
error PERMISSION_DENIED();
error AMOUNT_GT_BALANCE();

modifier onlyAuthorized() {
if (msg.sender != admin && msg.sender != IHasRecipient(admin).recipient()) {
Expand Down Expand Up @@ -77,6 +79,15 @@ contract ProverSet is EssentialContract, IERC1271 {
IERC20(tkoToken()).transfer(admin, _amount);
}

/// @notice Withdraws ETH back to the owner address.
function withdrawEther(uint256 _amount) external onlyOwner {
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
uint256 balance = address(this).balance;
if (balance < _amount) revert AMOUNT_GT_BALANCE();
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved

address _owner = owner();
LibAddress.sendEtherAndVerify(_owner, _amount);
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
}

/// @notice Propose a Taiko block.
function proposeBlock(
bytes calldata _params,
Expand Down