-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity ^0.8.0; | ||
|
||
import "@openzeppelin/contracts/utils/Address.sol"; | ||
import "./interfaces/SpokePoolInterface.sol"; | ||
|
||
/** | ||
* @notice SpokePoolVerifier is a contract that verifies that the SpokePool exists on this chain before sending ETH to it. | ||
*/ | ||
contract SpokePoolVerifier { | ||
using Address for address; | ||
|
||
function deposit( | ||
SpokePoolInterface spokePool, | ||
address recipient, | ||
address originToken, | ||
uint256 amount, | ||
uint256 destinationChainId, | ||
int64 relayerFeePct, | ||
uint32 quoteTimestamp, | ||
bytes memory message, | ||
uint256 maxCount | ||
) external payable { | ||
require(msg.value == amount, "msg.value != amount"); | ||
require(address(spokePool).isContract(), "spokePool is not a contract"); | ||
spokePool.deposit{ value: msg.value }( | ||
recipient, | ||
originToken, | ||
amount, | ||
destinationChainId, | ||
relayerFeePct, | ||
quoteTimestamp, | ||
message, | ||
maxCount | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, getNamedAccounts } = hre; | ||
const { deploy } = deployments; | ||
|
||
const { deployer } = await getNamedAccounts(); | ||
|
||
await deploy("SpokePoolVerifier", { | ||
from: deployer, | ||
log: true, | ||
skipIfAlreadyDeployed: true, | ||
deterministicDeployment: "0x1234", // Salt for the create2 call. | ||
}); | ||
}; | ||
|
||
module.exports = func; | ||
func.tags = ["SpokePoolVerifier", "polygon", "mainnet", "optimism", "arbitrum", "zksync"]; |