Skip to content
63 changes: 63 additions & 0 deletions contracts/Ethereum_SpokePool.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "./interfaces/WETH9.sol";

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "./SpokePool.sol";
import "./SpokePoolInterface.sol";

/**
* @notice Ethereum L1 specific SpokePool.
* @dev Used on Ethereum L1 to facilitate L2->L1 transfers.
*/

contract Ethereum_SpokePool is SpokePoolInterface, SpokePool, Ownable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed IRL, we might want to add a TODO to refactor the SpokePool inheritance setup s.t. we can have most of these methods implemented in the base contract and just have an _calledByAdmin() function that's implemented in each derived class, and have the base class call require(_calledByAdmin(), "not authorized");

constructor(
address _l1EthWrapper,
address _l2Eth,
address _crossDomainAdmin,
address _hubPool,
address _wethAddress,
address timerAddress
) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {}

/**************************************
* ADMIN FUNCTIONS *
**************************************/

function setCrossDomainAdmin(address newCrossDomainAdmin) public override onlyOwner nonReentrant {
_setCrossDomainAdmin(newCrossDomainAdmin);
}

function setHubPool(address newHubPool) public override onlyOwner nonReentrant {
_setHubPool(newHubPool);
}

function setEnableRoute(
address originToken,
uint32 destinationChainId,
bool enable
) public override onlyOwner nonReentrant {
_setEnableRoute(originToken, destinationChainId, enable);
}

function setDepositQuoteTimeBuffer(uint32 buffer) public override onlyOwner nonReentrant {
_setDepositQuoteTimeBuffer(buffer);
}

function initializeRelayerRefund(bytes32 relayerRepaymentDistributionRoot, bytes32 slowRelayRoot)
public
override
onlyOwner
nonReentrant
{
_initializeRelayerRefund(relayerRepaymentDistributionRoot, slowRelayRoot);
}

function _bridgeTokensToHubPool(DestinationDistributionLeaf memory distributionLeaf) internal override {
IERC20(distributionLeaf.l2TokenAddress).transfer(hubPool, distributionLeaf.amountToReturn);
}
}