From 504d5fa0c0f7a5e41784352cb20b73020e64c882 Mon Sep 17 00:00:00 2001 From: bmzig <57361391+bmzig@users.noreply.github.com> Date: Wed, 19 Feb 2025 10:46:22 -0600 Subject: [PATCH] feat: add zkStack adapters (#2100) * feat: add zkStack adapters Signed-off-by: bennett --------- Signed-off-by: bennett --- deployments/sepolia/AtomicWethDepositor.json | 42 ++-- .../37ed92c125868e00a3e658e73545b1c6.json | 45 ++++ src/adapter/bridges/ZKStackBridge.ts | 235 ++++++++++++++++++ src/adapter/bridges/ZKStackWethBridge.ts | 161 ++++++++++++ src/adapter/bridges/index.ts | 2 + src/clients/bridges/AdapterManager.ts | 2 +- src/common/Constants.ts | 40 ++- src/common/ContractAddresses.ts | 33 ++- src/common/abi/ZkStackBridgeHub.json | 168 +++++++++++++ src/common/abi/ZkStackNativeTokenVault.json | 89 +++++++ src/utils/index.ts | 2 +- 11 files changed, 784 insertions(+), 35 deletions(-) create mode 100644 deployments/sepolia/solcInputs/37ed92c125868e00a3e658e73545b1c6.json create mode 100644 src/adapter/bridges/ZKStackBridge.ts create mode 100644 src/adapter/bridges/ZKStackWethBridge.ts create mode 100644 src/common/abi/ZkStackBridgeHub.json create mode 100644 src/common/abi/ZkStackNativeTokenVault.json diff --git a/deployments/sepolia/AtomicWethDepositor.json b/deployments/sepolia/AtomicWethDepositor.json index ac9ca2ce6..3bd5c944c 100644 --- a/deployments/sepolia/AtomicWethDepositor.json +++ b/deployments/sepolia/AtomicWethDepositor.json @@ -1,5 +1,5 @@ { - "address": "0xDf9ADb0aA08Fd3F7bC41440Dc37370Fc9BD80f91", + "address": "0xdf87d6eFd856D6145Fcd387252cefD12868AC593", "abi": [ { "inputs": [], @@ -231,41 +231,41 @@ "type": "receive" } ], - "transactionHash": "0xe61d0c881f55dbbe424094d90612ba8be4fc4021e0489fa2d3d152b4a567dae7", + "transactionHash": "0x413493b35d88af31358c5279adb3d10e415047b2baf10fe58a6900b71bfda6e6", "receipt": { "to": null, "from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D", - "contractAddress": "0xDf9ADb0aA08Fd3F7bC41440Dc37370Fc9BD80f91", - "transactionIndex": 123, - "gasUsed": "1183736", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000800000000000010000000000000000000000000000000020000001000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xbb25a609ec23a28aebeca15eb56e84791d6135d5fb301201b052c1abb498cc43", - "transactionHash": "0xe61d0c881f55dbbe424094d90612ba8be4fc4021e0489fa2d3d152b4a567dae7", + "contractAddress": "0xdf87d6eFd856D6145Fcd387252cefD12868AC593", + "transactionIndex": 65, + "gasUsed": "1183748", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000400000000000000000000000000000000000000000000000000000000000001000000040000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000040000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000020000001000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7de59e2118a9a497a717973210c002f6f9642ffc203ace6078d394cc7face116", + "transactionHash": "0x413493b35d88af31358c5279adb3d10e415047b2baf10fe58a6900b71bfda6e6", "logs": [ { - "transactionIndex": 123, - "blockNumber": 7700444, - "transactionHash": "0xe61d0c881f55dbbe424094d90612ba8be4fc4021e0489fa2d3d152b4a567dae7", - "address": "0xDf9ADb0aA08Fd3F7bC41440Dc37370Fc9BD80f91", + "transactionIndex": 65, + "blockNumber": 7729901, + "transactionHash": "0x413493b35d88af31358c5279adb3d10e415047b2baf10fe58a6900b71bfda6e6", + "address": "0xdf87d6eFd856D6145Fcd387252cefD12868AC593", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000009a8f92a830a5cb89a3816e3d267cb7791c16b04d" ], "data": "0x", - "logIndex": 192, - "blockHash": "0xbb25a609ec23a28aebeca15eb56e84791d6135d5fb301201b052c1abb498cc43" + "logIndex": 4296, + "blockHash": "0x7de59e2118a9a497a717973210c002f6f9642ffc203ace6078d394cc7face116" } ], - "blockNumber": 7700444, - "cumulativeGasUsed": "11953880", + "blockNumber": 7729901, + "cumulativeGasUsed": "32189828", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "a4875bd777d9afdf683a4e5b67e80d39", - "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidBridgeFunction\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AtomicWethDepositInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"contract Weth\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"netValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bridgeValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"bridgeCallData\",\"type\":\"bytes\"}],\"name\":\"bridgeWeth\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"bridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"gateway\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSelector\",\"type\":\"bytes4\"}],\"internalType\":\"struct AtomicWethDepositor.Bridge\",\"name\":\"bridge\",\"type\":\"tuple\"}],\"name\":\"whitelistBridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistedBridgeFunctions\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"bridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"gateway\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSelector\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract is ownable so that the owner can update whitelisted bridge addresses and function selectors.\",\"kind\":\"dev\",\"methods\":{\"bridgeWeth(uint256,uint256,uint256,uint256,bytes)\":{\"details\":\"Requires that the owner of this contract has whitelisted the bridge contract and function selector for the chainId that the user wants to send ETH to.\",\"params\":{\"bridgeCallData\":\"The calldata to pass to the bridge contract. The first 4 bytes should be equal to the whitelisted function selector of the bridge contract.\",\"bridgeValue\":\"The amount of WETH which the depositor expects to receive on L2. That is, netValue - fees.\",\"chainId\":\"The chain to send ETH to.\",\"netValue\":\"The total amount of WETH to withdraw and send to the bridge contract.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"whitelistBridge(uint256,(address,address,address,bytes4))\":{\"params\":{\"bridge\":\"The Bridge struct to set to the specified chain ID.\",\"chainId\":\"The chain ID of the bridge.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bridgeWeth(uint256,uint256,uint256,uint256,bytes)\":{\"notice\":\"Initiates a WETH deposit to a whitelisted bridge for a specified chain with user calldata.\"},\"whitelistBridge(uint256,(address,address,address,bytes4))\":{\"notice\":\"Whitelists function selector and bridge contract for chain.\"},\"whitelistedBridgeFunctions(uint256)\":{\"notice\":\"Mapping of chain ID to whitelisted bridge addresses and function selectors that can be called by this contract.\"}},\"notice\":\"Contract deployed on Ethereum helps relay bots atomically unwrap and bridge WETH over the canonical chain bridges for chains that only support bridging of ETH not WETH.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/AtomicWethDepositor.sol\":\"AtomicWethDepositor\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc980984badf3984b6303b377711220e067722bbd6a135b24669ff5069ef9f32\",\"dweb:/ipfs/QmPHXMSXj99XjSVM21YsY6aNtLLjLVXDbyN76J5HQYvvrz\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bd39944e8fc06be6dbe2dd1d8449b5336e23c6a7ba3e8e9ae5ae0f37f35283f5\",\"dweb:/ipfs/QmPV3FGYjVwvKSgAXKUN3r9T9GwniZz83CxBpM7vyj2G53\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc5b5dc12fbc4002f282eaa7a5f06d8310ed62c1c77c5770f6283e058454c39a\",\"dweb:/ipfs/Qme9rE2wS3yBuyJq9GgbmzbsBQsW2M2sVFqYYLw7bosGrv\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9d213d3befca47da33f6db0310826bcdb148299805c10d77175ecfe1d06a9a68\",\"dweb:/ipfs/QmRgCn6SP1hbBkExUADFuDo8xkT4UU47yjNF5FhCeRbQmS\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2455248c8ddd9cc6a7af76a13973cddf222072427e7b0e2a7d1aff345145e931\",\"dweb:/ipfs/QmfYjnjRbWqYpuxurqveE6HtzsY1Xx323J428AKQgtBJZm\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@uma/core/contracts/common/implementation/Lockable.sol\":{\"keccak256\":\"0x41d78fcce54598ad5f26bc0b778c0f4fedbd836401625e49e736979f69a87ef0\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://4ce111bb50441ef5125e7d42284f6debbc17fd589515d7b8cede7e9d1d5f0ede\",\"dweb:/ipfs/QmaXiXACWVEDDHoCHNXdVBoNpf8QNHkUZ1kf5MfbxfL6jj\"]},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"keccak256\":\"0x9f6afe5bafc5e16fe8d63010a740ec3a88a9f00a7236ea7e5b039a2f50eb346e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://a971572a4a9ed32e5ec15ac384af593d9499778f6ec593dbdba67d44ced4c7d8\",\"dweb:/ipfs/QmbdpfhhnUyoHWe7TPFBZxT6R6zyxJEDcGBNwDt5ncweRv\"]},\"contracts/AtomicWethDepositor.sol\":{\"keccak256\":\"0x5d00b8c16282835d0a482d58567ed6e98071dbcf60d58a93cf13ba236f903be3\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://af0a964d6ec2276ee7e45410809c75fe66082e386ed01727c9c50b601dfe1ba0\",\"dweb:/ipfs/QmPo7f41zSmVrKaxMy6pXjw73Sw9a9SNirY9Y5b58LdcGe\"]}},\"version\":1}", - "bytecode": "0x60a08060405234610089575f543360018060a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a36001600160a81b0319163360ff60a01b191617600160a01b175f5573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2608052611425908161008e82396080518181816106010152610ef50152f35b5f80fdfe60806040526004361015610018575b361561001657005b005b5f3560e01c806331e57ede146100975780633a03c4a914610092578063715018a61461008d57806388319fe8146100885780638da5cb5b14610083578063ac9650d81461007e578063ad5c4648146100795763f2fde38b0361000e57610643565b6105b7565b61052f565b6103fa565b610261565b6101c7565b610118565b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760843567ffffffffffffffff80821161011457366023830112156101145781600401359081116101145736602482840101116101145760246100169201606435604435602435600435610779565b5f80fd5b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576004355f526001602052608060405f207fffffffff0000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff9182815416926002816001840154169201549160405194855260208501528116604084015260401b166060820152f35b5f91031261011457565b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576101fd611176565b5f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc360112610114576102c2611176565b6004355f526001602052600260405f206103226024356102e181610625565b829073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b61037560443561033181610625565b600183019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b016103856064356102e181610625565b6084357fffffffff00000000000000000000000000000000000000000000000000000000811681036101145781547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1660409190911c77ffffffff000000000000000000000000000000000000000016179055005b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b5f5b83811061045b5750505f910152565b818101518382015260200161044c565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020936104a78151809281875287808801910161044a565b0116010190565b6020808201906020835283518092526040830192602060408460051b8301019501935f915b8483106104e35750505050505090565b909192939495848061051f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a5161046b565b98019301930191949392906104d3565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145767ffffffffffffffff6004358181116101145736602382011215610114578060040135918211610114573660248360051b83010111610114576105b39160246105a79201610e10565b604051918291826104ae565b0390f35b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b73ffffffffffffffffffffffffffffffffffffffff81160361011457565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760043561067e81610625565b610686611176565b73ffffffffffffffffffffffffffffffffffffffff8091169081156106f5575f54827fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b949092919360ff5f5460a01c16156109d8576107b67fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f54165f55565b6107bf84610ede565b6107d96107d4875f52600160205260405f2090565b610af5565b9161080760608401517fffffffff000000000000000000000000000000000000000000000000000000001690565b7fffffffff0000000000000000000000000000000000000000000000000000000061085a6108358486610b75565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b9116036109ae57610904946108e2845f966108a961089060408a99015173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b9073ffffffffffffffffffffffffffffffffffffffff8216610976575b50505173ffffffffffffffffffffffffffffffffffffffff1690565b926108f260405180948193610bb9565b03925af16108fe610c00565b90610c43565b60405190815233907f07eaada8c9bcef700c8d25524866ae64bf4c9586cd632e43aa2ab78fc8dfef9e90602090a3610974740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f5416175f55565b565b6109a79161098682303384610fe4565b602084015173ffffffffffffffffffffffffffffffffffffffff1690611053565b5f806108c6565b60046040517f172b8892000000000000000000000000000000000000000000000000000000008152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b67ffffffffffffffff8111610a7757604052565b610a36565b6080810190811067ffffffffffffffff821117610a7757604052565b6040810190811067ffffffffffffffff821117610a7757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610a7757604052565b906040516080810181811067ffffffffffffffff821117610a775760405260607fffffffff000000000000000000000000000000000000000000000000000000008294600273ffffffffffffffffffffffffffffffffffffffff918281541686528260018201541660208701520154908116604085015260401b16910152565b7fffffffff000000000000000000000000000000000000000000000000000000009035818116939260048110610baa57505050565b60040360031b82901b16169150565b908092918237015f815290565b67ffffffffffffffff8111610a7757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b3d15610c2a573d90610c1182610bc6565b91610c1f6040519384610ab4565b82523d5f602084013e565b606090565b906020610c4092818152019061046b565b90565b15610c4b5750565b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260206004840152602483019061046b565b0390fd5b67ffffffffffffffff8111610a775760051b60200190565b90610caf82610c8d565b610cbc6040519182610ab4565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610cea8294610c8d565b01905f5b828110610cfa57505050565b806060602080938501015201610cee565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9190811015610d985760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561011457019081359167ffffffffffffffff8311610114576020018236038113610114579190565b610d0b565b6020818303126101145780519067ffffffffffffffff8211610114570181601f82011215610114578051610dd081610bc6565b92610dde6040519485610ab4565b8184526020828401011161011457610c40916020808501910161044a565b8051821015610d985760209160051b010190565b919091610e1c83610ca5565b925f5b818110610e2b57505050565b5f80610e38838587610d38565b60409391610e4a855180938193610bb9565b0390305af490610e58610c00565b9115610e7f575090600191610e6d8288610dfc565b52610e788187610dfc565b5001610e1f565b90604481511061011457610c89610ea460049283810151602480918301019101610d9d565b92519283927f08c379a00000000000000000000000000000000000000000000000000000000084528301610c2f565b6040513d5f823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b15610114576040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390525f8160648183865af18015610fcc57610fd1575b50803b15610114576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101929092525f908290602490829084905af18015610fcc57610fb95750565b80610fc661097492610a63565b806101bd565b610ed3565b80610fc6610fde92610a63565b5f610f69565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064808301939093529181526109749161104e608483610ab4565b61120c565b91909160405191602083015f807f095ea7b3000000000000000000000000000000000000000000000000000000009384845273ffffffffffffffffffffffffffffffffffffffff9081891660248901526044880152604487526110b587610a7c565b85169286519082855af1906110c8610c00565b82611144575b5081611139575b50156110e2575b50505050565b604051602081019190915273ffffffffffffffffffffffffffffffffffffffff9390931660248401525f60448085019190915283526111309261104e9061112a606482610ab4565b8261120c565b5f8080806110dc565b90503b15155f6110d5565b8051919250811591821561115c575b5050905f6110ce565b61116f92506020809183010191016111f4565b5f80611153565b73ffffffffffffffffffffffffffffffffffffffff5f5416330361119657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b90816020910312610114575180151581036101145790565b6040516112769173ffffffffffffffffffffffffffffffffffffffff1661123282610a98565b5f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1611270610c00565b9161132b565b805190828215928315611313575b5050501561128f5750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b61132393508201810191016111f4565b5f8281611284565b919290156113a6575081511561133f575090565b3b156113485790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156113b95750805190602001fd5b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301610c2f56fea26469706673582212209833a6604adc685802fa548b379198e2218db4c96fc7e9c1b3a51a68007065c464736f6c63430008170033", - "deployedBytecode": "0x60806040526004361015610018575b361561001657005b005b5f3560e01c806331e57ede146100975780633a03c4a914610092578063715018a61461008d57806388319fe8146100885780638da5cb5b14610083578063ac9650d81461007e578063ad5c4648146100795763f2fde38b0361000e57610643565b6105b7565b61052f565b6103fa565b610261565b6101c7565b610118565b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760843567ffffffffffffffff80821161011457366023830112156101145781600401359081116101145736602482840101116101145760246100169201606435604435602435600435610779565b5f80fd5b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576004355f526001602052608060405f207fffffffff0000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff9182815416926002816001840154169201549160405194855260208501528116604084015260401b166060820152f35b5f91031261011457565b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576101fd611176565b5f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc360112610114576102c2611176565b6004355f526001602052600260405f206103226024356102e181610625565b829073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b61037560443561033181610625565b600183019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b016103856064356102e181610625565b6084357fffffffff00000000000000000000000000000000000000000000000000000000811681036101145781547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1660409190911c77ffffffff000000000000000000000000000000000000000016179055005b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b5f5b83811061045b5750505f910152565b818101518382015260200161044c565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020936104a78151809281875287808801910161044a565b0116010190565b6020808201906020835283518092526040830192602060408460051b8301019501935f915b8483106104e35750505050505090565b909192939495848061051f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a5161046b565b98019301930191949392906104d3565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145767ffffffffffffffff6004358181116101145736602382011215610114578060040135918211610114573660248360051b83010111610114576105b39160246105a79201610e10565b604051918291826104ae565b0390f35b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b73ffffffffffffffffffffffffffffffffffffffff81160361011457565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760043561067e81610625565b610686611176565b73ffffffffffffffffffffffffffffffffffffffff8091169081156106f5575f54827fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b949092919360ff5f5460a01c16156109d8576107b67fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f54165f55565b6107bf84610ede565b6107d96107d4875f52600160205260405f2090565b610af5565b9161080760608401517fffffffff000000000000000000000000000000000000000000000000000000001690565b7fffffffff0000000000000000000000000000000000000000000000000000000061085a6108358486610b75565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b9116036109ae57610904946108e2845f966108a961089060408a99015173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b9073ffffffffffffffffffffffffffffffffffffffff8216610976575b50505173ffffffffffffffffffffffffffffffffffffffff1690565b926108f260405180948193610bb9565b03925af16108fe610c00565b90610c43565b60405190815233907f07eaada8c9bcef700c8d25524866ae64bf4c9586cd632e43aa2ab78fc8dfef9e90602090a3610974740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f5416175f55565b565b6109a79161098682303384610fe4565b602084015173ffffffffffffffffffffffffffffffffffffffff1690611053565b5f806108c6565b60046040517f172b8892000000000000000000000000000000000000000000000000000000008152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b67ffffffffffffffff8111610a7757604052565b610a36565b6080810190811067ffffffffffffffff821117610a7757604052565b6040810190811067ffffffffffffffff821117610a7757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610a7757604052565b906040516080810181811067ffffffffffffffff821117610a775760405260607fffffffff000000000000000000000000000000000000000000000000000000008294600273ffffffffffffffffffffffffffffffffffffffff918281541686528260018201541660208701520154908116604085015260401b16910152565b7fffffffff000000000000000000000000000000000000000000000000000000009035818116939260048110610baa57505050565b60040360031b82901b16169150565b908092918237015f815290565b67ffffffffffffffff8111610a7757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b3d15610c2a573d90610c1182610bc6565b91610c1f6040519384610ab4565b82523d5f602084013e565b606090565b906020610c4092818152019061046b565b90565b15610c4b5750565b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260206004840152602483019061046b565b0390fd5b67ffffffffffffffff8111610a775760051b60200190565b90610caf82610c8d565b610cbc6040519182610ab4565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610cea8294610c8d565b01905f5b828110610cfa57505050565b806060602080938501015201610cee565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9190811015610d985760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561011457019081359167ffffffffffffffff8311610114576020018236038113610114579190565b610d0b565b6020818303126101145780519067ffffffffffffffff8211610114570181601f82011215610114578051610dd081610bc6565b92610dde6040519485610ab4565b8184526020828401011161011457610c40916020808501910161044a565b8051821015610d985760209160051b010190565b919091610e1c83610ca5565b925f5b818110610e2b57505050565b5f80610e38838587610d38565b60409391610e4a855180938193610bb9565b0390305af490610e58610c00565b9115610e7f575090600191610e6d8288610dfc565b52610e788187610dfc565b5001610e1f565b90604481511061011457610c89610ea460049283810151602480918301019101610d9d565b92519283927f08c379a00000000000000000000000000000000000000000000000000000000084528301610c2f565b6040513d5f823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b15610114576040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390525f8160648183865af18015610fcc57610fd1575b50803b15610114576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101929092525f908290602490829084905af18015610fcc57610fb95750565b80610fc661097492610a63565b806101bd565b610ed3565b80610fc6610fde92610a63565b5f610f69565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064808301939093529181526109749161104e608483610ab4565b61120c565b91909160405191602083015f807f095ea7b3000000000000000000000000000000000000000000000000000000009384845273ffffffffffffffffffffffffffffffffffffffff9081891660248901526044880152604487526110b587610a7c565b85169286519082855af1906110c8610c00565b82611144575b5081611139575b50156110e2575b50505050565b604051602081019190915273ffffffffffffffffffffffffffffffffffffffff9390931660248401525f60448085019190915283526111309261104e9061112a606482610ab4565b8261120c565b5f8080806110dc565b90503b15155f6110d5565b8051919250811591821561115c575b5050905f6110ce565b61116f92506020809183010191016111f4565b5f80611153565b73ffffffffffffffffffffffffffffffffffffffff5f5416330361119657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b90816020910312610114575180151581036101145790565b6040516112769173ffffffffffffffffffffffffffffffffffffffff1661123282610a98565b5f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1611270610c00565b9161132b565b805190828215928315611313575b5050501561128f5750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b61132393508201810191016111f4565b5f8281611284565b919290156113a6575081511561133f575090565b3b156113485790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156113b95750805190602001fd5b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301610c2f56fea26469706673582212209833a6604adc685802fa548b379198e2218db4c96fc7e9c1b3a51a68007065c464736f6c63430008170033" + "numDeployments": 2, + "solcInputHash": "37ed92c125868e00a3e658e73545b1c6", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidBridgeFunction\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AtomicWethDepositInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"contract Weth\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"netValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bridgeValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"bridgeCallData\",\"type\":\"bytes\"}],\"name\":\"bridgeWeth\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"bridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"gateway\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSelector\",\"type\":\"bytes4\"}],\"internalType\":\"struct AtomicWethDepositor.Bridge\",\"name\":\"bridge\",\"type\":\"tuple\"}],\"name\":\"whitelistBridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistedBridgeFunctions\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"bridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"gateway\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSelector\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract is ownable so that the owner can update whitelisted bridge addresses and function selectors.\",\"kind\":\"dev\",\"methods\":{\"bridgeWeth(uint256,uint256,uint256,uint256,bytes)\":{\"details\":\"Requires that the owner of this contract has whitelisted the bridge contract and function selector for the chainId that the user wants to send ETH to.\",\"params\":{\"bridgeCallData\":\"The calldata to pass to the bridge contract. The first 4 bytes should be equal to the whitelisted function selector of the bridge contract.\",\"bridgeValue\":\"The amount of WETH which the depositor expects to receive on L2. That is, netValue - fees.\",\"chainId\":\"The chain to send ETH to.\",\"netValue\":\"The total amount of WETH to withdraw and send to the bridge contract.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"whitelistBridge(uint256,(address,address,address,bytes4))\":{\"params\":{\"bridge\":\"The Bridge struct to set to the specified chain ID.\",\"chainId\":\"The chain ID of the bridge.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bridgeWeth(uint256,uint256,uint256,uint256,bytes)\":{\"notice\":\"Initiates a WETH deposit to a whitelisted bridge for a specified chain with user calldata.\"},\"whitelistBridge(uint256,(address,address,address,bytes4))\":{\"notice\":\"Whitelists function selector and bridge contract for chain.\"},\"whitelistedBridgeFunctions(uint256)\":{\"notice\":\"Mapping of chain ID to whitelisted bridge addresses and function selectors that can be called by this contract.\"}},\"notice\":\"Contract deployed on Ethereum helps relay bots atomically unwrap and bridge WETH over the canonical chain bridges for chains that only support bridging of ETH not WETH.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/AtomicWethDepositor.sol\":\"AtomicWethDepositor\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc980984badf3984b6303b377711220e067722bbd6a135b24669ff5069ef9f32\",\"dweb:/ipfs/QmPHXMSXj99XjSVM21YsY6aNtLLjLVXDbyN76J5HQYvvrz\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bd39944e8fc06be6dbe2dd1d8449b5336e23c6a7ba3e8e9ae5ae0f37f35283f5\",\"dweb:/ipfs/QmPV3FGYjVwvKSgAXKUN3r9T9GwniZz83CxBpM7vyj2G53\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc5b5dc12fbc4002f282eaa7a5f06d8310ed62c1c77c5770f6283e058454c39a\",\"dweb:/ipfs/Qme9rE2wS3yBuyJq9GgbmzbsBQsW2M2sVFqYYLw7bosGrv\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9d213d3befca47da33f6db0310826bcdb148299805c10d77175ecfe1d06a9a68\",\"dweb:/ipfs/QmRgCn6SP1hbBkExUADFuDo8xkT4UU47yjNF5FhCeRbQmS\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2455248c8ddd9cc6a7af76a13973cddf222072427e7b0e2a7d1aff345145e931\",\"dweb:/ipfs/QmfYjnjRbWqYpuxurqveE6HtzsY1Xx323J428AKQgtBJZm\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@uma/core/contracts/common/implementation/Lockable.sol\":{\"keccak256\":\"0x41d78fcce54598ad5f26bc0b778c0f4fedbd836401625e49e736979f69a87ef0\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://4ce111bb50441ef5125e7d42284f6debbc17fd589515d7b8cede7e9d1d5f0ede\",\"dweb:/ipfs/QmaXiXACWVEDDHoCHNXdVBoNpf8QNHkUZ1kf5MfbxfL6jj\"]},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"keccak256\":\"0x9f6afe5bafc5e16fe8d63010a740ec3a88a9f00a7236ea7e5b039a2f50eb346e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://a971572a4a9ed32e5ec15ac384af593d9499778f6ec593dbdba67d44ced4c7d8\",\"dweb:/ipfs/QmbdpfhhnUyoHWe7TPFBZxT6R6zyxJEDcGBNwDt5ncweRv\"]},\"contracts/AtomicWethDepositor.sol\":{\"keccak256\":\"0xd1a8bb5e9fc1df31f0351c9cb0675398dd26ae5a22b62e43d824be00b8218779\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://3ad661433c1585799818ce987c9b8d23b55b2010c1aa3bb8ff78eaba5d917dfa\",\"dweb:/ipfs/QmPPR2xZSvJPjDQ1yCQay4Tj5BmJ4nJgeT8Frea7CrE8x6\"]}},\"version\":1}", + "bytecode": "0x60a08060405234610089575f543360018060a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a36001600160a81b0319163360ff60a01b191617600160a01b175f5573fff9976782d46cc05630d1f6ebab18b2324d6b14608052611425908161008e82396080518181816106010152610ef50152f35b5f80fdfe60806040526004361015610018575b361561001657005b005b5f3560e01c806331e57ede146100975780633a03c4a914610092578063715018a61461008d57806388319fe8146100885780638da5cb5b14610083578063ac9650d81461007e578063ad5c4648146100795763f2fde38b0361000e57610643565b6105b7565b61052f565b6103fa565b610261565b6101c7565b610118565b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760843567ffffffffffffffff80821161011457366023830112156101145781600401359081116101145736602482840101116101145760246100169201606435604435602435600435610779565b5f80fd5b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576004355f526001602052608060405f207fffffffff0000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff9182815416926002816001840154169201549160405194855260208501528116604084015260401b166060820152f35b5f91031261011457565b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576101fd611176565b5f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc360112610114576102c2611176565b6004355f526001602052600260405f206103226024356102e181610625565b829073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b61037560443561033181610625565b600183019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b016103856064356102e181610625565b6084357fffffffff00000000000000000000000000000000000000000000000000000000811681036101145781547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1660409190911c77ffffffff000000000000000000000000000000000000000016179055005b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b5f5b83811061045b5750505f910152565b818101518382015260200161044c565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020936104a78151809281875287808801910161044a565b0116010190565b6020808201906020835283518092526040830192602060408460051b8301019501935f915b8483106104e35750505050505090565b909192939495848061051f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a5161046b565b98019301930191949392906104d3565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145767ffffffffffffffff6004358181116101145736602382011215610114578060040135918211610114573660248360051b83010111610114576105b39160246105a79201610e10565b604051918291826104ae565b0390f35b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b73ffffffffffffffffffffffffffffffffffffffff81160361011457565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760043561067e81610625565b610686611176565b73ffffffffffffffffffffffffffffffffffffffff8091169081156106f5575f54827fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b949092919360ff5f5460a01c16156109d8576107b67fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f54165f55565b6107bf84610ede565b6107d96107d4875f52600160205260405f2090565b610af5565b9161080760608401517fffffffff000000000000000000000000000000000000000000000000000000001690565b7fffffffff0000000000000000000000000000000000000000000000000000000061085a6108358486610b75565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b9116036109ae57610904946108e2845f966108a961089060408a99015173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b9073ffffffffffffffffffffffffffffffffffffffff8216610976575b50505173ffffffffffffffffffffffffffffffffffffffff1690565b926108f260405180948193610bb9565b03925af16108fe610c00565b90610c43565b60405190815233907f07eaada8c9bcef700c8d25524866ae64bf4c9586cd632e43aa2ab78fc8dfef9e90602090a3610974740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f5416175f55565b565b6109a79161098682303384610fe4565b602084015173ffffffffffffffffffffffffffffffffffffffff1690611053565b5f806108c6565b60046040517f172b8892000000000000000000000000000000000000000000000000000000008152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b67ffffffffffffffff8111610a7757604052565b610a36565b6080810190811067ffffffffffffffff821117610a7757604052565b6040810190811067ffffffffffffffff821117610a7757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610a7757604052565b906040516080810181811067ffffffffffffffff821117610a775760405260607fffffffff000000000000000000000000000000000000000000000000000000008294600273ffffffffffffffffffffffffffffffffffffffff918281541686528260018201541660208701520154908116604085015260401b16910152565b7fffffffff000000000000000000000000000000000000000000000000000000009035818116939260048110610baa57505050565b60040360031b82901b16169150565b908092918237015f815290565b67ffffffffffffffff8111610a7757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b3d15610c2a573d90610c1182610bc6565b91610c1f6040519384610ab4565b82523d5f602084013e565b606090565b906020610c4092818152019061046b565b90565b15610c4b5750565b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260206004840152602483019061046b565b0390fd5b67ffffffffffffffff8111610a775760051b60200190565b90610caf82610c8d565b610cbc6040519182610ab4565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610cea8294610c8d565b01905f5b828110610cfa57505050565b806060602080938501015201610cee565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9190811015610d985760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561011457019081359167ffffffffffffffff8311610114576020018236038113610114579190565b610d0b565b6020818303126101145780519067ffffffffffffffff8211610114570181601f82011215610114578051610dd081610bc6565b92610dde6040519485610ab4565b8184526020828401011161011457610c40916020808501910161044a565b8051821015610d985760209160051b010190565b919091610e1c83610ca5565b925f5b818110610e2b57505050565b5f80610e38838587610d38565b60409391610e4a855180938193610bb9565b0390305af490610e58610c00565b9115610e7f575090600191610e6d8288610dfc565b52610e788187610dfc565b5001610e1f565b90604481511061011457610c89610ea460049283810151602480918301019101610d9d565b92519283927f08c379a00000000000000000000000000000000000000000000000000000000084528301610c2f565b6040513d5f823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b15610114576040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390525f8160648183865af18015610fcc57610fd1575b50803b15610114576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101929092525f908290602490829084905af18015610fcc57610fb95750565b80610fc661097492610a63565b806101bd565b610ed3565b80610fc6610fde92610a63565b5f610f69565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064808301939093529181526109749161104e608483610ab4565b61120c565b91909160405191602083015f807f095ea7b3000000000000000000000000000000000000000000000000000000009384845273ffffffffffffffffffffffffffffffffffffffff9081891660248901526044880152604487526110b587610a7c565b85169286519082855af1906110c8610c00565b82611144575b5081611139575b50156110e2575b50505050565b604051602081019190915273ffffffffffffffffffffffffffffffffffffffff9390931660248401525f60448085019190915283526111309261104e9061112a606482610ab4565b8261120c565b5f8080806110dc565b90503b15155f6110d5565b8051919250811591821561115c575b5050905f6110ce565b61116f92506020809183010191016111f4565b5f80611153565b73ffffffffffffffffffffffffffffffffffffffff5f5416330361119657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b90816020910312610114575180151581036101145790565b6040516112769173ffffffffffffffffffffffffffffffffffffffff1661123282610a98565b5f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1611270610c00565b9161132b565b805190828215928315611313575b5050501561128f5750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b61132393508201810191016111f4565b5f8281611284565b919290156113a6575081511561133f575090565b3b156113485790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156113b95750805190602001fd5b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301610c2f56fea2646970667358221220cb23c48a68bef86b72e3083bc101afeec1dbc26332e59ec56c6d1e4bcd123e5064736f6c63430008170033", + "deployedBytecode": "0x60806040526004361015610018575b361561001657005b005b5f3560e01c806331e57ede146100975780633a03c4a914610092578063715018a61461008d57806388319fe8146100885780638da5cb5b14610083578063ac9650d81461007e578063ad5c4648146100795763f2fde38b0361000e57610643565b6105b7565b61052f565b6103fa565b610261565b6101c7565b610118565b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760843567ffffffffffffffff80821161011457366023830112156101145781600401359081116101145736602482840101116101145760246100169201606435604435602435600435610779565b5f80fd5b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576004355f526001602052608060405f207fffffffff0000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff9182815416926002816001840154169201549160405194855260208501528116604084015260401b166060820152f35b5f91031261011457565b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610114576101fd611176565b5f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101145760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc360112610114576102c2611176565b6004355f526001602052600260405f206103226024356102e181610625565b829073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b61037560443561033181610625565b600183019073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b016103856064356102e181610625565b6084357fffffffff00000000000000000000000000000000000000000000000000000000811681036101145781547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1660409190911c77ffffffff000000000000000000000000000000000000000016179055005b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b5f5b83811061045b5750505f910152565b818101518382015260200161044c565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020936104a78151809281875287808801910161044a565b0116010190565b6020808201906020835283518092526040830192602060408460051b8301019501935f915b8483106104e35750505050505090565b909192939495848061051f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a5161046b565b98019301930191949392906104d3565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145767ffffffffffffffff6004358181116101145736602382011215610114578060040135918211610114573660248360051b83010111610114576105b39160246105a79201610e10565b604051918291826104ae565b0390f35b34610114575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b73ffffffffffffffffffffffffffffffffffffffff81160361011457565b346101145760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101145760043561067e81610625565b610686611176565b73ffffffffffffffffffffffffffffffffffffffff8091169081156106f5575f54827fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b949092919360ff5f5460a01c16156109d8576107b67fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f54165f55565b6107bf84610ede565b6107d96107d4875f52600160205260405f2090565b610af5565b9161080760608401517fffffffff000000000000000000000000000000000000000000000000000000001690565b7fffffffff0000000000000000000000000000000000000000000000000000000061085a6108358486610b75565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b9116036109ae57610904946108e2845f966108a961089060408a99015173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b9073ffffffffffffffffffffffffffffffffffffffff8216610976575b50505173ffffffffffffffffffffffffffffffffffffffff1690565b926108f260405180948193610bb9565b03925af16108fe610c00565b90610c43565b60405190815233907f07eaada8c9bcef700c8d25524866ae64bf4c9586cd632e43aa2ab78fc8dfef9e90602090a3610974740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f5416175f55565b565b6109a79161098682303384610fe4565b602084015173ffffffffffffffffffffffffffffffffffffffff1690611053565b5f806108c6565b60046040517f172b8892000000000000000000000000000000000000000000000000000000008152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b67ffffffffffffffff8111610a7757604052565b610a36565b6080810190811067ffffffffffffffff821117610a7757604052565b6040810190811067ffffffffffffffff821117610a7757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610a7757604052565b906040516080810181811067ffffffffffffffff821117610a775760405260607fffffffff000000000000000000000000000000000000000000000000000000008294600273ffffffffffffffffffffffffffffffffffffffff918281541686528260018201541660208701520154908116604085015260401b16910152565b7fffffffff000000000000000000000000000000000000000000000000000000009035818116939260048110610baa57505050565b60040360031b82901b16169150565b908092918237015f815290565b67ffffffffffffffff8111610a7757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b3d15610c2a573d90610c1182610bc6565b91610c1f6040519384610ab4565b82523d5f602084013e565b606090565b906020610c4092818152019061046b565b90565b15610c4b5750565b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260206004840152602483019061046b565b0390fd5b67ffffffffffffffff8111610a775760051b60200190565b90610caf82610c8d565b610cbc6040519182610ab4565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0610cea8294610c8d565b01905f5b828110610cfa57505050565b806060602080938501015201610cee565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9190811015610d985760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561011457019081359167ffffffffffffffff8311610114576020018236038113610114579190565b610d0b565b6020818303126101145780519067ffffffffffffffff8211610114570181601f82011215610114578051610dd081610bc6565b92610dde6040519485610ab4565b8184526020828401011161011457610c40916020808501910161044a565b8051821015610d985760209160051b010190565b919091610e1c83610ca5565b925f5b818110610e2b57505050565b5f80610e38838587610d38565b60409391610e4a855180938193610bb9565b0390305af490610e58610c00565b9115610e7f575090600191610e6d8288610dfc565b52610e788187610dfc565b5001610e1f565b90604481511061011457610c89610ea460049283810151602480918301019101610d9d565b92519283927f08c379a00000000000000000000000000000000000000000000000000000000084528301610c2f565b6040513d5f823e3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b15610114576040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390525f8160648183865af18015610fcc57610fd1575b50803b15610114576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101929092525f908290602490829084905af18015610fcc57610fb95750565b80610fc661097492610a63565b806101bd565b610ed3565b80610fc6610fde92610a63565b5f610f69565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff92831660248201529290911660448301526064808301939093529181526109749161104e608483610ab4565b61120c565b91909160405191602083015f807f095ea7b3000000000000000000000000000000000000000000000000000000009384845273ffffffffffffffffffffffffffffffffffffffff9081891660248901526044880152604487526110b587610a7c565b85169286519082855af1906110c8610c00565b82611144575b5081611139575b50156110e2575b50505050565b604051602081019190915273ffffffffffffffffffffffffffffffffffffffff9390931660248401525f60448085019190915283526111309261104e9061112a606482610ab4565b8261120c565b5f8080806110dc565b90503b15155f6110d5565b8051919250811591821561115c575b5050905f6110ce565b61116f92506020809183010191016111f4565b5f80611153565b73ffffffffffffffffffffffffffffffffffffffff5f5416330361119657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b90816020910312610114575180151581036101145790565b6040516112769173ffffffffffffffffffffffffffffffffffffffff1661123282610a98565b5f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1611270610c00565b9161132b565b805190828215928315611313575b5050501561128f5750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b61132393508201810191016111f4565b5f8281611284565b919290156113a6575081511561133f575090565b3b156113485790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156113b95750805190602001fd5b610c89906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301610c2f56fea2646970667358221220cb23c48a68bef86b72e3083bc101afeec1dbc26332e59ec56c6d1e4bcd123e5064736f6c63430008170033" } diff --git a/deployments/sepolia/solcInputs/37ed92c125868e00a3e658e73545b1c6.json b/deployments/sepolia/solcInputs/37ed92c125868e00a3e658e73545b1c6.json new file mode 100644 index 000000000..138b9f1c0 --- /dev/null +++ b/deployments/sepolia/solcInputs/37ed92c125868e00a3e658e73545b1c6.json @@ -0,0 +1,45 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/Lockable.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract\n * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol\n * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.\n */\ncontract Lockable {\n bool private _notEntered;\n\n constructor() {\n // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every\n // call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full\n // refund coming into effect.\n _notEntered = true;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant` function is not supported. It is possible to\n * prevent this from happening by making the `nonReentrant` function external, and making it call a `private`\n * function that does the actual state modification.\n */\n modifier nonReentrant() {\n _preEntranceCheck();\n _preEntranceSet();\n _;\n _postEntranceReset();\n }\n\n /**\n * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method.\n */\n modifier nonReentrantView() {\n _preEntranceCheck();\n _;\n }\n\n // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method.\n // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being\n // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and\n // then call `_postEntranceReset()`.\n // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered.\n function _preEntranceCheck() internal view {\n // On the first call to nonReentrant, _notEntered will be true\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\n }\n\n function _preEntranceSet() internal {\n // Any calls to nonReentrant after this point will fail\n _notEntered = false;\n }\n\n function _postEntranceReset() internal {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _notEntered = true;\n }\n\n // These functions are intended to be used by child contracts to temporarily disable and re-enable the guard.\n // Intended use:\n // _startReentrantGuardDisabled();\n // ...\n // _endReentrantGuardDisabled();\n //\n // IMPORTANT: these should NEVER be used in a method that isn't inside a nonReentrant block. Otherwise, it's\n // possible to permanently lock your contract.\n function _startReentrantGuardDisabled() internal {\n _notEntered = true;\n }\n\n function _endReentrantGuardDisabled() internal {\n _notEntered = false;\n }\n}\n" + }, + "@uma/core/contracts/common/implementation/MultiCaller.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.0;\n\n// This contract is taken from Uniswap's multi call implementation (https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/base/Multicall.sol)\n// and was modified to be solidity 0.8 compatible. Additionally, the method was restricted to only work with msg.value\n// set to 0 to avoid any nasty attack vectors on function calls that use value sent with deposits.\n\n/// @title MultiCaller\n/// @notice Enables calling multiple methods in a single call to the contract\ncontract MultiCaller {\n function multicall(bytes[] calldata data) external returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n\n if (!success) {\n // Next 5 lines from https://ethereum.stackexchange.com/a/83577\n if (result.length < 68) revert();\n assembly {\n result := add(result, 0x04)\n }\n revert(abi.decode(result, (string)));\n }\n\n results[i] = result;\n }\n }\n}\n" + }, + "contracts/AtomicWethDepositor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@uma/core/contracts/common/implementation/MultiCaller.sol\";\nimport \"@uma/core/contracts/common/implementation/Lockable.sol\";\n\ninterface Weth {\n function withdraw(uint256 _wad) external;\n\n function transferFrom(address _from, address _to, uint256 _wad) external;\n}\n\n/**\n * @notice Contract deployed on Ethereum helps relay bots atomically unwrap and bridge WETH over the canonical chain\n * bridges for chains that only support bridging of ETH not WETH.\n * @dev This contract is ownable so that the owner can update whitelisted bridge addresses and function selectors.\n */\ncontract AtomicWethDepositor is Ownable, MultiCaller, Lockable {\n using SafeERC20 for IERC20;\n // The Bridge used to send ETH to another chain. Only the function selector can be used when\n // calling the bridge contract.\n struct Bridge {\n // Address of the contract to call when bridging ETH.\n address bridge;\n // Address of the contract to approve when bridging ETH. An approval is only sent if `feeToken` is\n // not the zero address.\n address gateway;\n // Address of the fee token used to pay for L1-L2 bridging.\n address feeToken;\n // The approved function selector for `bridge`. This contract may only call this function\n // when calling the `bridge` contract.\n bytes4 funcSelector;\n }\n\n Weth public immutable WETH = Weth(0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14);\n\n /**\n * @notice Mapping of chain ID to whitelisted bridge addresses and function selectors\n * that can be called by this contract.\n */\n mapping(uint256 => Bridge) public whitelistedBridgeFunctions;\n\n ///////////////////////////////\n // Events //\n ///////////////////////////////\n\n event AtomicWethDepositInitiated(address indexed from, uint256 indexed chainId, uint256 amount);\n\n ///////////////////////////////\n // Errors //\n ///////////////////////////////\n\n error InvalidBridgeFunction();\n\n ///////////////////////////////\n // Internal Functions //\n ///////////////////////////////\n\n /**\n * @notice Transfers WETH to this contract and withdraws it to ETH.\n * @param amount The amount of WETH to withdraw.\n */\n function _withdrawWeth(uint256 amount) internal {\n WETH.transferFrom(msg.sender, address(this), amount);\n WETH.withdraw(amount);\n }\n\n ///////////////////////////////\n // Admin Functions //\n ///////////////////////////////\n\n /**\n * @notice Whitelists function selector and bridge contract for chain.\n * @param chainId The chain ID of the bridge.\n * @param bridge The Bridge struct to set to the specified chain ID.\n */\n function whitelistBridge(uint256 chainId, Bridge calldata bridge) public onlyOwner {\n whitelistedBridgeFunctions[chainId] = bridge;\n }\n\n ///////////////////////////////\n // Public Functions //\n ///////////////////////////////\n\n /**\n * @notice Initiates a WETH deposit to a whitelisted bridge for a specified chain with user calldata.\n * @dev Requires that the owner of this contract has whitelisted the bridge contract and function\n * selector for the chainId that the user wants to send ETH to.\n * @param netValue The total amount of WETH to withdraw and send to the bridge contract.\n * @param bridgeValue The amount of WETH which the depositor expects to receive on L2. That is, netValue - fees.\n * @param chainId The chain to send ETH to.\n * @param bridgeCallData The calldata to pass to the bridge contract. The first 4 bytes should be equal\n * to the whitelisted function selector of the bridge contract.\n */\n function bridgeWeth(\n uint256 chainId,\n uint256 netValue,\n uint256 bridgeValue,\n uint256 feeAmount,\n bytes calldata bridgeCallData\n ) public nonReentrant {\n _withdrawWeth(netValue);\n Bridge memory bridge = whitelistedBridgeFunctions[chainId];\n if (bridge.funcSelector != bytes4(bridgeCallData)) revert InvalidBridgeFunction();\n\n IERC20 feeToken = IERC20(bridge.feeToken);\n if (address(feeToken) != address(0)) {\n feeToken.safeTransferFrom(msg.sender, address(this), feeAmount);\n feeToken.forceApprove(bridge.gateway, feeAmount);\n }\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory result) = bridge.bridge.call{ value: netValue }(bridgeCallData);\n require(success, string(result));\n emit AtomicWethDepositInitiated(msg.sender, chainId, bridgeValue);\n }\n\n fallback() external payable {}\n\n // Included to remove a compilation warning.\n // NOTE: this should not affect behavior.\n receive() external payable {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "viaIR": true, + "outputSelection": { + "*": { + "*": ["abi", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "metadata"], + "": ["ast"] + } + } + } +} diff --git a/src/adapter/bridges/ZKStackBridge.ts b/src/adapter/bridges/ZKStackBridge.ts new file mode 100644 index 000000000..6611240cf --- /dev/null +++ b/src/adapter/bridges/ZKStackBridge.ts @@ -0,0 +1,235 @@ +import assert from "assert"; +import { + Contract, + BigNumber, + Signer, + EventSearchConfig, + Provider, + ethers, + TOKEN_SYMBOLS_MAP, + compareAddressesSimple, + paginatedEventQuery, + ZERO_BYTES, + isContractDeployedToAddress, +} from "../../utils"; +import { processEvent, matchL2EthDepositAndWrapEvents } from "../utils"; +import { CONTRACT_ADDRESSES } from "../../common"; +import { BridgeTransactionDetails, BaseBridgeAdapter, BridgeEvents } from "./BaseBridgeAdapter"; +import * as zksync from "zksync-ethers"; +import { gasPriceOracle } from "@across-protocol/sdk"; +import { PUBLIC_NETWORKS } from "@across-protocol/constants"; + +/* For both the canonical bridge (this bridge) and the ZkStackWethBridge + * bridge, we need to assume that the l1 and l2 signers contain + * associated providers, since we need to get information about + * addresses and gas prices (this is also why `constructL1toL2Txn` + * is an async fn). + */ +export class ZKStackBridge extends BaseBridgeAdapter { + readonly gasPerPubdataLimit = zksync.utils.REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT; + readonly l2GasLimit = BigNumber.from(2_000_000); + readonly sharedBridgeAddress: string; + readonly l2GasToken: Contract; + readonly l2WrappedGasToken: Contract; + readonly hubPool: Contract; + readonly tokenVault: Contract; + + constructor( + l2chainId: number, + hubChainId: number, + l1Signer: Signer, + l2SignerOrProvider: Signer | Provider, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _l1Token: string + ) { + const sharedBridgeAddress = CONTRACT_ADDRESSES[hubChainId][`zkStackSharedBridge_${l2chainId}`].address; + super(l2chainId, hubChainId, l1Signer, l2SignerOrProvider, [sharedBridgeAddress]); + + const nativeToken = PUBLIC_NETWORKS[l2chainId].nativeToken; + // Only set nonstandard gas tokens. + if (nativeToken !== "ETH") { + this.gasToken = TOKEN_SYMBOLS_MAP[nativeToken].addresses[hubChainId]; + } + + const { address: l1Address, abi: l1Abi } = CONTRACT_ADDRESSES[hubChainId].zkStackBridgeHub; + this.l1Bridge = new Contract(l1Address, l1Abi, l1Signer); + + this.sharedBridgeAddress = sharedBridgeAddress; + + const { address: l2Address, abi: l2Abi } = CONTRACT_ADDRESSES[l2chainId].zkStackBridge; + this.l2Bridge = new Contract(l2Address, l2Abi, l2SignerOrProvider); + + // This bridge treats hub pool transfers differently from EOA rebalances, so we must know the hub pool address. + const { address: hubPoolAddress, abi: hubPoolAbi } = CONTRACT_ADDRESSES[hubChainId].hubPool; + this.hubPool = new Contract(hubPoolAddress, hubPoolAbi); + + // We need the L2 gas token contract for ZkStack since this contract mints directly to the recipient + // when a bridge is completed. + const { address: l2GasTokenAddress, abi: l2GasTokenAbi } = CONTRACT_ADDRESSES[l2chainId].gasToken; + const { address: l2WrappedGasTokenAddress, abi: l2WrappedGasTokenAbi } = + CONTRACT_ADDRESSES[l2chainId].wrappedGasToken; + this.l2GasToken = new Contract(l2GasTokenAddress, l2GasTokenAbi, l2SignerOrProvider); + this.l2WrappedGasToken = new Contract(l2WrappedGasTokenAddress, l2WrappedGasTokenAbi, l2SignerOrProvider); + + // The contract which emits the bridge events we wish to track is the L1NativeTokenVault. + const { address: tokenVaultAddress, abi: tokenVaultAbi } = + CONTRACT_ADDRESSES[hubChainId][`nativeTokenVault_${l2chainId}`]; + this.tokenVault = new Contract(tokenVaultAddress, tokenVaultAbi, l1Signer); + } + + async constructL1ToL2Txn( + toAddress: string, + l1Token: string, + l2Token: string, + amount: BigNumber + ): Promise { + // The zkStack bridges need to know the l2 gas price bid beforehand. If this bid is too small, the transaction will revert. + const txBaseCost = await this._txBaseCost(); + const secondBridgeCalldata = this._secondBridgeCalldata(toAddress, l1Token, amount); + + // The method/arguments change depending on whether or not we are bridging the gas token or another ERC20. + const bridgingGasToken = l1Token === this.gasToken; + const method = bridgingGasToken ? "requestL2TransactionDirect" : "requestL2TransactionTwoBridges"; + const args = bridgingGasToken + ? [ + [ + this.l2chainId, + txBaseCost.add(amount), + toAddress, + amount, + "0x", + this.l2GasLimit, + this.gasPerPubdataLimit, + [], + toAddress, + ], + ] + : [ + [ + this.l2chainId, + txBaseCost, + 0, + this.l2GasLimit, + this.gasPerPubdataLimit, + toAddress, + this.sharedBridgeAddress, + 0, + secondBridgeCalldata, + ], + ]; + + return { + contract: this.getL1Bridge(), + method, + args, + }; + } + + async queryL1BridgeInitiationEvents( + l1Token: string, + fromAddress: string, + toAddress: string, + eventConfig: EventSearchConfig + ): Promise { + // If the fromAddress is the hub pool then ignore the query. This is because for calculating cross-chain + // transfers, we query both the hub pool outstanding transfers *and* the spoke pool outstanding transfers, + // meaning that querying this function for the hub pool as well would effectively double count the outstanding transfer amount. + if (compareAddressesSimple(fromAddress, this.hubPool.address)) { + return {}; + } + + // Logic changes based on whether we are sending tokens to the spoke pool or to an EOA. + const isL2Contract = await this._isContract(toAddress, this.getL2Bridge().provider!); + let processedEvents; + // If we are sending tokens to an L2 contract, then we can just look at the hub pool tokens relayed function since we assume the hub pool is sending tokens to the spoke pool. + if (isL2Contract) { + processedEvents = (await paginatedEventQuery(this.hubPool, this.hubPool.filters.TokensRelayed(), eventConfig)) + .filter((e) => compareAddressesSimple(e.args.to, toAddress) && compareAddressesSimple(e.args.l1Token, l1Token)) + .map((e) => { + return { + ...processEvent(e, "amount", "to", "to"), + from: this.hubPool.address, + }; + }); + } else { + // Otherwise, we will need to query the token vault directly. We are either bridging an ERC20 token or the custom gas token. + // The bridge contract does not emit the address of the token -- it instead emits an asset ID string, which we + // must query from the l1TokenVault contract. + const assetId = await this.tokenVault.assetId(l1Token); + assert(assetId !== ZERO_BYTES); // Assert the asset id we are querying is supported by the bridge. + + processedEvents = ( + await paginatedEventQuery( + this.tokenVault, + this.tokenVault.filters.BridgeBurn(this.l2chainId, assetId, fromAddress), + eventConfig + ) + ).map((e) => processEvent(e, "amount", "receiver", "sender")); + } + return { + [this.resolveL2TokenAddress(l1Token)]: processedEvents, + }; + } + + async queryL2BridgeFinalizationEvents( + l1Token: string, + fromAddress: string, + toAddress: string, + eventConfig: EventSearchConfig + ): Promise { + // Ignore hub pool queries for the same reason as above. + if (compareAddressesSimple(fromAddress, this.hubPool.address)) { + return {}; + } + const bridgingGasToken = l1Token === this.gasToken; + + // Optionally alias the l1 sender. + const isL1Contract = await this._isContract(fromAddress, this.getL1Bridge().provider!); + const aliasedSender = isL1Contract ? zksync.utils.applyL1ToL2Alias(fromAddress) : fromAddress; + let processedEvents; + if (!bridgingGasToken) { + processedEvents = await paginatedEventQuery( + this.l2GasToken, + this.l2GasToken.filters.Transfer(aliasedSender, toAddress), + eventConfig + ); + } else { + // We unfortunately can't assume that the wrapped native token will emit an event when minting new tokens (i.e. a Transfer from the zero address), so we instead query the transfer of the native token to the wrapped native token contract. + const [events, wrapEvents] = await Promise.all([ + paginatedEventQuery(this.l2GasToken, this.l2GasToken.filters.Transfer(aliasedSender, toAddress), eventConfig), + paginatedEventQuery( + this.l2GasToken, + this.l2GasToken.filters.Transfer(toAddress, this.l2WrappedGasToken.address), + eventConfig + ), + ]); + processedEvents = matchL2EthDepositAndWrapEvents(events, wrapEvents); + } + return { + [this.resolveL2TokenAddress(l1Token)]: processedEvents.map((e) => processEvent(e, "_amount", "_to", "from")), + }; + } + + _secondBridgeCalldata(toAddress: string, l1Token: string, amount: BigNumber): string { + return ethers.utils.defaultAbiCoder.encode(["address", "uint256", "address"], [l1Token, amount, toAddress]); + } + + async _txBaseCost(): Promise { + const l1GasPriceData = await gasPriceOracle.getGasPriceEstimate(this.getL1Bridge().provider!); + + // Similar to the ZkSyncBridge types, we must calculate the l2 gas cost by querying a system contract. In this case, + // the system contract to query is the bridge hub contract. + const estimatedL1GasPrice = l1GasPriceData.maxPriorityFeePerGas.add(l1GasPriceData.maxFeePerGas); + const l2Gas = await this.getL1Bridge().l2TransactionBaseCost( + this.l2chainId, + estimatedL1GasPrice, + this.l2GasLimit, + this.gasPerPubdataLimit + ); + return l2Gas; + } + + async _isContract(address: string, provider: Provider): Promise { + return isContractDeployedToAddress(address, provider); + } +} diff --git a/src/adapter/bridges/ZKStackWethBridge.ts b/src/adapter/bridges/ZKStackWethBridge.ts new file mode 100644 index 000000000..052778f6e --- /dev/null +++ b/src/adapter/bridges/ZKStackWethBridge.ts @@ -0,0 +1,161 @@ +import { + Contract, + BigNumber, + EventSearchConfig, + Signer, + Provider, + ZERO_ADDRESS, + bnZero, + compareAddressesSimple, + paginatedEventQuery, + isDefined, +} from "../../utils"; +import { ZKStackBridge } from "./"; +import { processEvent, matchL2EthDepositAndWrapEvents } from "../utils"; +import { CONTRACT_ADDRESSES } from "../../common"; +import { BridgeTransactionDetails, BridgeEvents } from "./BaseBridgeAdapter"; + +const ETH_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000001"; +export class ZKStackWethBridge extends ZKStackBridge { + private readonly atomicDepositor: Contract; + private readonly l2Weth: Contract; + private readonly l2Eth: Contract; + + constructor( + l2chainId: number, + hubChainId: number, + l1Signer: Signer, + l2SignerOrProvider: Signer | Provider, + l1Token: string + ) { + super(l2chainId, hubChainId, l1Signer, l2SignerOrProvider, l1Token); + const { address: atomicDepositorAddress, abi: atomicDepositorAbi } = CONTRACT_ADDRESSES[hubChainId].atomicDepositor; + this.atomicDepositor = new Contract(atomicDepositorAddress, atomicDepositorAbi, l1Signer); + + // Overwrite the bridge gateway to the correct gateway. The correct gateway is the atomic depositor since this is the + // address which is pulling weth out of the relayer via a `transferFrom`. + this.l1Gateways = [atomicDepositorAddress]; + + // Grab both the l2 WETH and l2 ETH contract addresses. Note: If the L2 uses a custom gas token, then the l2 ETH contract + // will be unused, so it must not necessarily be defined in CONTRACT_ADDRESSES. + const { address: l2WethAddress, abi: l2WethAbi } = CONTRACT_ADDRESSES[l2chainId].l2Weth; + this.l2Weth = new Contract(l2WethAddress, l2WethAbi, l2SignerOrProvider); + if (!isDefined(this.gasToken)) { + const { address: l2EthAddress, abi: l2EthAbi } = CONTRACT_ADDRESSES[l2chainId].l2Eth; + this.l2Eth = new Contract(l2EthAddress, l2EthAbi, l2SignerOrProvider); + } + } + + override async constructL1ToL2Txn( + toAddress: string, + l1Token: string, + l2Token: string, + amount: BigNumber + ): Promise { + const txBaseCost = await this._txBaseCost(); + const secondBridgeCalldata = this._secondBridgeCalldata(toAddress, ETH_TOKEN_ADDRESS, bnZero); + + const bridgeCalldata = this.getL1Bridge().interface.encodeFunctionData("requestL2TransactionTwoBridges", [ + [ + this.l2chainId, + txBaseCost, + 0, + this.l2GasLimit, + this.gasPerPubdataLimit, + toAddress, + this.sharedBridgeAddress, + amount, + secondBridgeCalldata, + ], + ]); + const usingCustomGasToken = isDefined(this.gasToken); + const netValue = usingCustomGasToken ? amount : amount.add(txBaseCost); + const feeAmount = usingCustomGasToken ? txBaseCost : bnZero; + + return { + contract: this.getAtomicDepositor(), + method: "bridgeWeth", + args: [this.l2chainId, netValue, amount, feeAmount, bridgeCalldata], + }; + } + + async queryL1BridgeInitiationEvents( + l1Token: string, + fromAddress: string, + toAddress: string, + eventConfig: EventSearchConfig + ): Promise { + // If the fromAddress is the hub pool then ignore the query. This is because for calculating cross-chain + // transfers, we query both the hub pool outstanding transfers *and* the spoke pool outstanding transfers, + // meaning that querying this function for the hub pool as well would effectively double count the outstanding transfer amount. + if (compareAddressesSimple(fromAddress, this.hubPool.address)) { + return {}; + } + + const isL2Contract = await this._isContract(toAddress, this.getL2Bridge().provider!); + let processedEvents; + if (isL2Contract) { + processedEvents = (await paginatedEventQuery(this.hubPool, this.hubPool.filters.TokensRelayed(), eventConfig)) + .filter((e) => compareAddressesSimple(e.args.to, toAddress) && compareAddressesSimple(e.args.l1Token, l1Token)) + .map((e) => { + return { + ...processEvent(e, "amount", "to", "to"), + from: this.hubPool.address, + }; + }); + } else { + // This means we are bridging via an EOA, so we should just look for atomic weth deposits. + const events = await paginatedEventQuery( + this.getAtomicDepositor(), + this.getAtomicDepositor().filters.AtomicWethDepositInitiated(fromAddress, this.l2chainId), + eventConfig + ); + // If we are in this branch, then the depositor is an EOA, so we can assume that from == to. + processedEvents = events.map((e) => processEvent(e, "amount", "from", "from")); + } + return { + [this.resolveL2TokenAddress(l1Token)]: processedEvents, + }; + } + + async queryL2BridgeFinalizationEvents( + l1Token: string, + fromAddress: string, + toAddress: string, + eventConfig: EventSearchConfig + ): Promise { + // Ignore hub pool queries for the same reason as above. + if (compareAddressesSimple(fromAddress, this.hubPool.address)) { + return {}; + } + const isL2Contract = await this._isContract(toAddress, this.getL2Bridge().provider!); + + // Events change slightly if the L2 has a custom gas token. + const usingCustomGasToken = isDefined(this.gasToken); + + let processedEvents; + if (isL2Contract || usingCustomGasToken) { + // Assume the transfer came from the hub pool. If the chain has a custom gas token, then query weth. Otherwise, + // query ETH. + const ethContract = usingCustomGasToken ? this.l2Weth : this.l2Eth; + processedEvents = await paginatedEventQuery( + ethContract, + ethContract.filters.Transfer(ZERO_ADDRESS, toAddress), + eventConfig + ); + } else { + // The transaction originated from the atomic depositor and the L2 does not use a custom gas token. + const [events, wrapEvents] = await Promise.all([ + paginatedEventQuery(this.l2Eth, this.l2Eth.filters.Transfer(ZERO_ADDRESS, toAddress), eventConfig), + paginatedEventQuery(this.l2Weth, this.l2Weth.filters.Transfer(ZERO_ADDRESS, toAddress), eventConfig), + ]); + processedEvents = matchL2EthDepositAndWrapEvents(events, wrapEvents); + } + return { + [this.resolveL2TokenAddress(l1Token)]: processedEvents.map((e) => processEvent(e, "_amount", "_to", "from")), + }; + } + private getAtomicDepositor(): Contract { + return this.atomicDepositor; + } +} diff --git a/src/adapter/bridges/index.ts b/src/adapter/bridges/index.ts index 7849df6ef..15a0f11a7 100644 --- a/src/adapter/bridges/index.ts +++ b/src/adapter/bridges/index.ts @@ -16,3 +16,5 @@ export * from "./BlastBridge"; export * from "./ScrollERC20Bridge"; export * from "./OpStackUSDCBridge"; export * from "./UsdcCCTPBridge"; +export * from "./ZKStackBridge"; +export * from "./ZKStackWethBridge"; diff --git a/src/clients/bridges/AdapterManager.ts b/src/clients/bridges/AdapterManager.ts index 8bc6854ce..1a014e380 100644 --- a/src/clients/bridges/AdapterManager.ts +++ b/src/clients/bridges/AdapterManager.ts @@ -93,7 +93,7 @@ export class AdapterManager { const adapter = this.adapters[chainId]; // @dev The adapter should filter out tokens that are not supported by the adapter, but we do it here as well. const adapterSupportedL1Tokens = l1Tokens.filter((token) => - adapter.supportedTokens.includes(this.hubPoolClient.getTokenInfo(CHAIN_IDs.MAINNET, token).symbol) + adapter.supportedTokens.includes(this.hubPoolClient.getTokenInfo(this.hubPoolClient.chainId, token).symbol) ); this.logger.debug({ at: "AdapterManager", diff --git a/src/common/Constants.ts b/src/common/Constants.ts index 4146819b6..e866c89ab 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -18,6 +18,8 @@ import { ScrollERC20Bridge, OpStackUSDCBridge, UsdcCCTPBridge, + ZKStackBridge, + ZKStackWethBridge, } from "../adapter/bridges"; import { DEFAULT_L2_CONTRACT_ADDRESSES } from "@eth-optimism/sdk"; import { CONTRACT_ADDRESSES } from "./ContractAddresses"; @@ -311,15 +313,14 @@ export const SUPPORTED_TOKENS: { [chainId: number]: string[] } = { [CHAIN_IDs.ZORA]: ["USDC", "WETH"], // Testnets: - [CHAIN_IDs.ARBITRUM_SEPOLIA]: ["USDC", "USDT", "WETH", "DAI", "WBTC", "UMA", "ACX"], - [CHAIN_IDs.BASE_SEPOLIA]: ["BAL", "DAI", "ETH", "WETH", "USDC"], + [CHAIN_IDs.ARBITRUM_SEPOLIA]: ["USDC", "WETH"], + [CHAIN_IDs.BASE_SEPOLIA]: ["WETH", "USDC"], [CHAIN_IDs.BLAST_SEPOLIA]: ["WETH"], - [CHAIN_IDs.LENS_SEPOLIA]: ["WETH"], - [CHAIN_IDs.LISK_SEPOLIA]: ["WETH", "USDT"], + [CHAIN_IDs.LENS_SEPOLIA]: ["WETH", "GRASS"], + [CHAIN_IDs.LISK_SEPOLIA]: ["WETH"], [CHAIN_IDs.UNICHAIN_SEPOLIA]: ["WETH", "USDC"], - [CHAIN_IDs.MODE_SEPOLIA]: ["ETH", "WETH", "USDC", "USDT", "WBTC"], - [CHAIN_IDs.OPTIMISM_SEPOLIA]: ["DAI", "SNX", "BAL", "ETH", "WETH", "USDC", "USDT", "WBTC", "UMA", "ACX"], - [CHAIN_IDs.SCROLL_SEPOLIA]: ["WETH", "USDC", "USDT", "WBTC"], + [CHAIN_IDs.MODE_SEPOLIA]: ["WETH"], + [CHAIN_IDs.OPTIMISM_SEPOLIA]: ["WETH", "USDC"], }; /** @@ -357,7 +358,6 @@ export const CANONICAL_BRIDGE: { [CHAIN_IDs.BLAST]: OpStackDefaultERC20Bridge, [CHAIN_IDs.UNICHAIN]: OpStackDefaultERC20Bridge, [CHAIN_IDs.INK]: OpStackDefaultERC20Bridge, - [CHAIN_IDs.LENS_SEPOLIA]: ZKSyncBridge, // TODO [CHAIN_IDs.LINEA]: LineaBridge, [CHAIN_IDs.LISK]: OpStackDefaultERC20Bridge, [CHAIN_IDs.MODE]: OpStackDefaultERC20Bridge, @@ -370,6 +370,7 @@ export const CANONICAL_BRIDGE: { [CHAIN_IDs.ZK_SYNC]: ZKSyncBridge, [CHAIN_IDs.ZORA]: OpStackDefaultERC20Bridge, // Testnets: + [CHAIN_IDs.LENS_SEPOLIA]: ZKStackBridge, [CHAIN_IDs.ARBITRUM_SEPOLIA]: ArbitrumOrbitBridge, [CHAIN_IDs.BASE_SEPOLIA]: OpStackDefaultERC20Bridge, [CHAIN_IDs.BLAST_SEPOLIA]: OpStackDefaultERC20Bridge, @@ -478,6 +479,9 @@ export const CUSTOM_BRIDGE: { [TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.SEPOLIA]]: PolygonWethBridge, [TOKEN_SYMBOLS_MAP.USDC.addresses[CHAIN_IDs.SEPOLIA]]: UsdcTokenSplitterBridge, }, + [CHAIN_IDs.LENS_SEPOLIA]: { + [TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.SEPOLIA]]: ZKStackWethBridge, + }, [CHAIN_IDs.UNICHAIN_SEPOLIA]: { [TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.SEPOLIA]]: OpStackWethBridge, }, @@ -698,6 +702,21 @@ export const OPSTACK_CONTRACT_OVERRIDES = { }, // Testnets + [CHAIN_IDs.BASE_SEPOLIA]: { + l1: { + AddressManager: "0x709c2B8ef4A9feFc629A8a2C1AF424Dc5BD6ad1B", + L1CrossDomainMessenger: "0xC34855F4De64F1840e5686e64278da901e261f20", + L1StandardBridge: CONTRACT_ADDRESSES[CHAIN_IDs.SEPOLIA].ovmStandardBridge_84532.address, + StateCommitmentChain: ZERO_ADDRESS, + CanonicalTransactionChain: ZERO_ADDRESS, + BondManager: ZERO_ADDRESS, + OptimismPortal: "0x49f53e41452C74589E85cA1677426Ba426459e85", + L2OutputOracle: ZERO_ADDRESS, + OptimismPortal2: "0x49f53e41452C74589E85cA1677426Ba426459e85", + DisputeGameFactory: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1", + }, + l2: DEFAULT_L2_CONTRACT_ADDRESSES, + }, [CHAIN_IDs.LISK_SEPOLIA]: { l1: { AddressManager: "0x27Bb4A7cd8FB20cb816BF4Aac668BF841bb3D5d3", @@ -726,7 +745,10 @@ export const OPSTACK_CONTRACT_OVERRIDES = { OptimismPortal2: ZERO_ADDRESS, DisputeGameFactory: ZERO_ADDRESS, }, - l2: DEFAULT_L2_CONTRACT_ADDRESSES, + l2: { + ...DEFAULT_L2_CONTRACT_ADDRESSES, + WETH: TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.BLAST_SEPOLIA], + }, }, [CHAIN_IDs.MODE_SEPOLIA]: { l1: { diff --git a/src/common/ContractAddresses.ts b/src/common/ContractAddresses.ts index 7ce7d7463..3818191df 100644 --- a/src/common/ContractAddresses.ts +++ b/src/common/ContractAddresses.ts @@ -34,6 +34,8 @@ import BLAST_OPTIMISM_PORTAL_ABI from "./abi/BlastOptimismPortal.json"; import SCROLL_GATEWAY_ROUTER_L1_ABI from "./abi/ScrollGatewayRouterL1.json"; import SCROLL_GATEWAY_ROUTER_L2_ABI from "./abi/ScrollGatewayRouterL2.json"; import SCROLL_GAS_PRICE_ORACLE_ABI from "./abi/ScrollGasPriceOracle.json"; +import ZKSTACK_BRIDGE_HUB_ABI from "./abi/ZkStackBridgeHub.json"; +import ZKSTACK_NATIVE_TOKEN_VAULT_ABI from "./abi/ZkStackNativeTokenVault.json"; // Constants file exporting hardcoded contract addresses per chain. export const CONTRACT_ADDRESSES: { @@ -477,7 +479,7 @@ export const CONTRACT_ADDRESSES: { abi: CCTP_TOKEN_MESSENGER_ABI, }, atomicDepositor: { - address: "0xDf9ADb0aA08Fd3F7bC41440Dc37370Fc9BD80f91", + address: "0xdf87d6eFd856D6145Fcd387252cefD12868AC593", abi: ATOMIC_DEPOSITOR_ABI, }, polygonRootChainManager: { @@ -499,8 +501,22 @@ export const CONTRACT_ADDRESSES: { orbitErc20Gateway_421614: { abi: ARBITRUM_ERC20_GATEWAY_L1_ABI, }, + zkStackBridgeHub: { + address: "0x236D1c3Ff32Bd0Ca26b72Af287E895627c0478cE", + abi: ZKSTACK_BRIDGE_HUB_ABI, + }, + // The shared bridge is the "spender" of the token we wish to bridge, so we only + // need its contract address so that we may approve it. + zkStackSharedBridge_37111: { + address: "0xfD3130Ea0e8B7Dd61Ac3663328a66d97eb02f84b", + }, + nativeTokenVault_37111: { + address: "0x257CE1e946c9C6531E2C9deBF7fcf821F9467f73", + abi: ZKSTACK_NATIVE_TOKEN_VAULT_ABI, + }, hubPool: { address: "0x14224e63716afAcE30C9a417E0542281869f7d9e", + abi: HUB_POOL_ABI, }, }, [CHAIN_IDs.ARBITRUM_SEPOLIA]: { @@ -537,11 +553,22 @@ export const CONTRACT_ADDRESSES: { }, }, [CHAIN_IDs.LENS_SEPOLIA]: { - // TODO: Rename to zkstack once zkstack adapters are made. - zkSyncDefaultErc20Bridge: { + zkStackBridge: { address: "0x427373Be173120D7A042b44D0804E37F25E7330b", abi: ZK_SYNC_DEFAULT_ERC20_BRIDGE_L2_ABI, }, + gasToken: { + address: "0x000000000000000000000000000000000000800A", + abi: WETH_ABI, + }, + wrappedGasToken: { + address: "0xeee5a340Cdc9c179Db25dea45AcfD5FE8d4d3eB8", + abi: WETH_ABI, + }, + l2Weth: { + address: "0xaA91D645D7a6C1aeaa5988e0547267B77d33fe16", + abi: WETH_ABI, + }, }, [CHAIN_IDs.LISK_SEPOLIA]: { ovmStandardBridge: { diff --git a/src/common/abi/ZkStackBridgeHub.json b/src/common/abi/ZkStackBridgeHub.json new file mode 100644 index 000000000..a45e380ce --- /dev/null +++ b/src/common/abi/ZkStackBridgeHub.json @@ -0,0 +1,168 @@ +[ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_chainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_gasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2GasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2GasPerPubdataByteLimit", + "type": "uint256" + } + ], + "name": "l2TransactionBaseCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintValue", + "type": "uint256" + }, + { + "internalType": "address", + "name": "l2Contract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "l2Value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "l2Calldata", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "l2GasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "l2GasPerPubdataByteLimit", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "factoryDeps", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "refundRecipient", + "type": "address" + } + ], + "internalType": "struct L2TransactionRequestDirect", + "name": "_request", + "type": "tuple" + } + ], + "name": "requestL2TransactionDirect", + "outputs": [ + { + "internalType": "bytes32", + "name": "canonicalTxHash", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "l2Value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "l2GasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "l2GasPerPubdataByteLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "refundRecipient", + "type": "address" + }, + { + "internalType": "address", + "name": "secondBridgeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "secondBridgeValue", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "secondBridgeCalldata", + "type": "bytes" + } + ], + "internalType": "struct L2TransactionRequestTwoBridgesOuter", + "name": "_request", + "type": "tuple" + } + ], + "name": "requestL2TransactionTwoBridges", + "outputs": [ + { + "internalType": "bytes32", + "name": "canonicalTxHash", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + } +] diff --git a/src/common/abi/ZkStackNativeTokenVault.json b/src/common/abi/ZkStackNativeTokenVault.json new file mode 100644 index 000000000..535954c30 --- /dev/null +++ b/src/common/abi/ZkStackNativeTokenVault.json @@ -0,0 +1,89 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "assetId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BridgeBurn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "assetId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BridgeMint", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "assetId", + "outputs": [ + { + "internalType": "bytes32", + "name": "assetId", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/utils/index.ts b/src/utils/index.ts index 855a67e1e..771c91980 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -6,7 +6,7 @@ import winston from "winston"; import assert from "assert"; export { winston, assert }; -export const { MAX_SAFE_ALLOWANCE } = sdkConstants; +export const { MAX_SAFE_ALLOWANCE, ZERO_BYTES } = sdkConstants; export const { AddressZero: ZERO_ADDRESS, MaxUint256: MAX_UINT_VAL } = ethersConstants; export {