Verified contractExactMIT
L1WETHNestedSyncHelper
Address0x47023dcb966e8dca5064c9fc6397d6699b3afa35
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,456,102
- Creation transaction
- 0x0aa2acf378…38f4253189
src/L1WETHNestedSyncHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IWETHNestedL1 { function deposit() external payable; function withdraw(uint256) external; function approve(address,uint256) external returns(bool); }
interface IBridgeNestedL1 { function bridgeTokens(address,uint256,uint64,address) external; function bridgeEther(uint64,address) external payable; }
/// @notice L1 leg of the nested synchronous route. Its bridge return is
/// delivered to the L2 route and the nested call must succeed before the
/// originating L2 call can return.
contract L1WETHNestedSyncHelper {
address public immutable bridge;
address public immutable weth;
address public immutable l2RouteProxy;
address public immutable authorizedProxy;
uint64 public immutable l2Rollup;
error Unauthorized(); error Failed();
constructor(address b,address w,address p,uint64 r) { bridge=b; weth=w; l2RouteProxy=p; authorizedProxy=p; l2Rollup=r; }
function executeLocalToBridged(uint256 amount,address recipient) external {
if(msg.sender!=authorizedProxy || address(this).balance<amount) revert Unauthorized();
IWETHNestedL1(weth).deposit{value:amount}();
if(!IWETHNestedL1(weth).approve(bridge,amount)) revert Failed();
IBridgeNestedL1(bridge).bridgeTokens(weth,amount,l2Rollup,recipient);
}
function executeBridgedToLocal(uint256 amount,address recipient) external {
if(msg.sender!=authorizedProxy) revert Unauthorized();
IWETHNestedL1(weth).withdraw(amount);
IBridgeNestedL1(bridge).bridgeEther{value:amount}(l2Rollup,recipient);
}
receive() external payable {}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.